File tree 1 file changed +13
-3
lines changed
1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change 3047
3047
function fieldset ( args ) { // a form fieldset
3048
3048
if ( ! ( this instanceof fieldset ) ) return new fieldset ( args ) // so fieldset() is like new fieldset()
3049
3049
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 }
3051
3051
3052
3052
for ( a in attrs ) {
3053
3053
if ( args [ a ] !== undefined ) {
3054
3054
attrs [ a ] = args [ a ]
3055
3055
delete args [ a ]
3056
3056
}
3057
3057
}
3058
+ attrs . disabled = booleanize ( attrs . disabled )
3058
3059
3059
3060
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 )
3061
3063
$ ( `<legend>${ attrs . legend } </legend>` ) . appendTo ( attrs . jfieldset )
3062
3064
3063
3065
var cfieldset = { // this structure implements a JavaScript "closure"
3066
3068
return attrs . legend
3067
3069
} ,
3068
3070
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 )
3070
3080
} ,
3071
3081
get pos ( ) {
3072
3082
return attrs . jfieldset
You can’t perform that action at this time.
0 commit comments