20 'accept-charset' : 12,
\r
32 cellpadding : 22, //
\r
34 cellspacing : 23, //
\r
68 frameborder : 49, //
\r
75 'http-equiv' : 55, //
\r
148 'class' : 'className',
\r
149 accesskey : 'accessKey',
\r
150 'accept-charset' : 'acceptCharset',
\r
151 bgcolor : 'bgColor',
\r
152 cellpadding : 'cellPadding',
\r
153 cellspacing : 'cellSpacing',
\r
156 codebase : 'codeBase',
\r
157 codetype : 'codeType',
\r
158 colspan : 'colSpan',
\r
159 datetime : 'dateTime',
\r
161 frameborder : 'frameBorder',
\r
162 'http-equiv' : 'httpEquiv',
\r
164 longdesc : 'longDesc',
\r
165 maxlength : 'maxLength',
\r
167 readonly : 'readOnly',
\r
168 rowspan : 'rowSpan',
\r
169 tabindex : 'tabIndex',
\r
171 valuetype : 'valueType',
\r
172 checked : 'defaultChecked'
\r
175 objToAttrText : function( obj ){
\r
176 var noValue = X.Dom.Attr.noValue, attrs = [], n = -1, p;
\r
178 attrs[ ++n ] = noValue[ p ] ? p : [ p, '="', obj[ p ], '"' ].join( '' );
\r
180 return attrs.join( ' ' );
\r
184 (function( toIndex, toName, renameForDOM, renameForTag ){
\r
186 for( name in toIndex ){
\r
187 if( typeof ( i = toIndex[ name ] ) === 'number' ){
\r
188 toName[ i ] = name;
\r
191 for( name in renameForDOM ){
\r
192 renameForTag[ renameForDOM[ name ] ] = name;
\r
194 })( X.Dom.Attr.toIndex, X.Dom.Attr.toName, X.Dom.Attr.renameForDOM, X.Dom.Attr.renameForTag );
\r
198 /* --------------------------------------
\r
200 * X.Dom.Attr.toIndex に定義されている 属性の場合
\r
202 * http://nanto.asablo.jp/blog/2005/10/29/123294
\r
203 * className, onclick等 はここで設定しない
\r
206 X.Dom.Node.prototype.attr = function( nameOrObj /* v */ ){
\r
207 var attrs = this._attrs, newAttrs, f;
\r
209 if( this._xnodeType !== 1 ) return this;
\r
211 if( nameOrObj && X.Type.isObject( nameOrObj ) ){
\r
212 attrs || ( attrs = this._attrs = {} );
\r
213 newAttrs = this._newAttrs || ( this._newAttrs = {} );
\r
215 for( p in nameOrObj ){
\r
216 if( this._setAttr( attrs, newAttrs, p, nameOrObj[ p ] ) === true ) f = true;
\r
219 delete this._attrText;
\r
220 this._dirty |= X.Dom.Dirty.ATTR;
\r
221 this._root && this._reserveUpdate();
\r
225 if( 1 < arguments.length ){
\r
227 if( this._setAttr( attrs || ( this._attrs = {} ), this._newAttrs || ( this._newAttrs = {} ), nameOrObj, arguments[ 1 ] ) === true ){
\r
228 delete this._attrText;
\r
229 this._dirty |= X.Dom.Dirty.ATTR;
\r
230 this._root && this._reserveUpdate();
\r
234 if( typeof nameOrObj === 'string' && attrs ){
\r
236 return attrs[ nameOrObj ];
\r
239 X.Dom.Node.prototype._setAttr = function( attrs, newAttrs, name, v ){
\r
240 if( name === 'UID' ) return;
\r
241 if( name === 'id' ){
\r
242 v = v !== 'ie4uid' + this._uid ? v : undefined;
\r
243 if( v !== this._id ){
\r
245 this._dirty |= X.Dom.Dirty.ID;
\r
246 this._root && this._reserveUpdate();
\r
250 if( name === 'class' ) return this.className( v );
\r
251 if( name === 'style' ) return this.cssText( v );
\r
253 if( name.indexOf( 'on' ) === 0 ){
\r
254 X.Notification.warn( 'xnode.attr("' + name + '") is wrong, xnode.listen() & xnode.unlisten().' );
\r
258 name = X.Dom.Attr.renameForTag[ name ] || name;
\r
259 if( attrs[ name ] === v ) return;
\r
262 newAttrs[ name ] = undefined;
\r
263 if( attrs.hasOwnProperty( name ) ) delete attrs[ name ];
\r
265 newAttrs[ name ] = attrs[ name ] = v;
\r