Index: trunk/extensions/ApiSandbox/ext.apiSandbox.js |
— | — | @@ -128,28 +128,25 @@ |
129 | 129 | } |
130 | 130 | |
131 | 131 | function select( values, attributes, selected ) { |
132 | | - var s = '<select class="api-sandbox-input"'; |
| 132 | + attributes['class'] = 'api-sandbox-input'; |
133 | 133 | if ( isset( attributes.multiple ) ) { |
134 | | - s += ' size="' + values.length + '"'; |
| 134 | + attributes['size'] = values.length.toString(); |
135 | 135 | } |
136 | | - for ( var a in attributes ) { |
137 | | - s += ' ' + a + '="' + attributes[a] + '"'; |
138 | | - } |
139 | | - s += '>'; |
| 136 | + var s = ''; |
140 | 137 | if ( typeof selected != 'array' ) { |
141 | 138 | if ( selected ) { |
142 | | - s += '\n<option value="" selected="selected">' + mw.msg( 'apisb-select-value' ) + '</option>'; |
| 139 | + s += mw.html.element( 'option', { value: '', selected: 'selected' }, mw.msg( 'apisb-select-value' ) ); |
143 | 140 | } |
144 | 141 | selected = []; |
145 | 142 | } |
146 | 143 | for ( var i = 0; i < values.length; i++ ) { |
147 | | - s += '\n<option value="' + values[i] + '"'; |
| 144 | + var attrs = { value: values[i] }; |
148 | 145 | if ( $.inArray( values[i], selected ) >= 0 ) { |
149 | | - s += ' selected="selected"'; |
| 146 | + attrs.selected = 'selected'; |
150 | 147 | } |
151 | | - s += '>' + values[i] + '</option>'; |
| 148 | + s += '\n' + mw.html.element( 'option', attrs, values[i] ); |
152 | 149 | } |
153 | | - s += '\n</select>'; |
| 150 | + s = mw.html.element( 'select', attributes, new mw.html.Raw( s ) ); |
154 | 151 | return s; |
155 | 152 | } |
156 | 153 | |