File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change 30473047 function fieldset ( args ) { // a form fieldset
30483048 if ( ! ( this instanceof fieldset ) ) return new fieldset ( args ) // so fieldset() is like new fieldset()
30493049 var cvs = canvas . get_selected ( )
3050- var attrs = { pos :cvs . caption_anchor , legend :'' , width :cvs . width }
3050+ var attrs = { pos :cvs . caption_anchor , legend :'' , width :cvs . width , disabled : false }
30513051
30523052 for ( a in attrs ) {
30533053 if ( args [ a ] !== undefined ) {
30543054 attrs [ a ] = args [ a ]
30553055 delete args [ a ]
30563056 }
30573057 }
3058+ attrs . disabled = booleanize ( attrs . disabled )
30583059
30593060 let fs_css = { width :`${ attrs . width } px` }
3060- attrs . jfieldset = $ ( '<fieldset>' ) . css ( fs_css ) . appendTo ( attrs . pos )
3061+ let fs_string = `<fieldset ${ attrs . disabled ?'disabled' :'' } >`
3062+ attrs . jfieldset = $ ( fs_string ) . css ( fs_css ) . appendTo ( attrs . pos )
30613063 $ ( `<legend>${ attrs . legend } </legend>` ) . appendTo ( attrs . jfieldset )
30623064
30633065 var cfieldset = { // this structure implements a JavaScript "closure"
30663068 return attrs . legend
30673069 } ,
30683070 set legend ( value ) {
3069- throw new Error ( "Cannot change a fieldsets legend." )
3071+ attrs . legend = value
3072+ $ ( attrs . jfieldset ) . find ( 'legend' ) . html ( value )
3073+ } ,
3074+ get disabled ( ) {
3075+ return attrs . disabled
3076+ } ,
3077+ set disabled ( value ) {
3078+ attrs . disabled = booleanize ( value )
3079+ $ ( attrs . jfieldset ) . attr ( 'disabled' , attrs . disabled )
30703080 } ,
30713081 get pos ( ) {
30723082 return attrs . jfieldset
You can’t perform that action at this time.
0 commit comments