OSDN Git Service

Version 0.6.49, fix for xnode.attr(name).
authoritozyun <itozyun@user.sourceforge.jp>
Mon, 23 Jun 2014 22:27:26 +0000 (07:27 +0900)
committeritozyun <itozyun@user.sourceforge.jp>
Mon, 23 Jun 2014 22:27:26 +0000 (07:27 +0900)
0.6.x/index.html
0.6.x/js/dom/11_XDomNode.js
0.6.x/js/dom/14_XDomAttr.js

index bd5426f..0291492 100644 (file)
@@ -1,7 +1,7 @@
 <!DOCTYPE html>\r
 <html lang="ja" class="js-disabled">\r
 <head>\r
-<meta charset="utf-8">\r
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">\r
 <title>New X.UI</title>\r
 <meta name="HandheldFriendly" content="true">\r
 <meta name="mobileoptimized" content="0">\r
index 11bb2eb..d04c661 100644 (file)
@@ -1258,7 +1258,7 @@ Node.prototype._actualRemove =
        X.Dom.DOM_IE4 ?\r
                ( function( isChild ){\r
                        var xnodes = this._xnodes,\r
-                               elm    = this._rawNode || this._xnodeType === 1 && this._ie4getRawNode(),\r
+                               elm    = this._rawNode || this._ie4getRawNode(),\r
                                i, l, xnode;\r
                        if( xnodes && ( l = xnodes.length ) ){\r
                                for( i = 0; i < l; ++i ){\r
@@ -1273,7 +1273,7 @@ Node.prototype._actualRemove =
                                this._attrs.value = elm.value;\r
                        };\r
                        elm.removeAttribute( 'id' ); // ?\r
-                       document.all[ this._id || ( 'ie4uid' + this._uid ) ] = null; // ?\r
+                       document.all[ this._id || ( 'ie4uid' + this._uid ) ] = null; // MacIE5 でエラー\r
                        if( !isChild ) elm.outerHTML = '';\r
                        delete this._rawNode;\r
                }) :\r
index cecb84c..af1b6ac 100644 (file)
@@ -86,7 +86,7 @@ X.Dom.Attr = {
  * \r
  */\r
 X.Dom.Node.prototype.attr = function( nameOrObj /* v */ ){\r
-       var attrs = this._attrs, newAttrs, f, p, elm;\r
+       var attrs = this._attrs, newAttrs, f, p, elm, v;\r
        \r
        if( this._xnodeType !== 1 ) return this;\r
        \r
@@ -113,14 +113,7 @@ X.Dom.Node.prototype.attr = function( nameOrObj /* v */ ){
                };\r
                return this;\r
        } else\r
-       if( nameOrObj === 'value' && X.Dom.Attr.HAS_VALUE[ this._tag.toUpperCase() ] ){\r
-               if( this._newAttrs && this._newAttrs.value ) return this._newAttrs.value;\r
-               if( elm = X.Dom.DOM_IE4 ? this._rawNode || this._ie4getRawNode() : this._rawNode ){\r
-                       attrs.value = elm.value;\r
-               };\r
-               return attrs.value;\r
-       } else\r
-       if( typeof nameOrObj === 'string' && attrs ){\r
+       if( typeof nameOrObj === 'string' ){\r
                // getter\r
                switch( nameOrObj ){\r
                        case 'id' :\r
@@ -134,8 +127,18 @@ X.Dom.Node.prototype.attr = function( nameOrObj /* v */ ){
                        case 'style' :\r
                        case 'cssText' :\r
                                return this.cssText();\r
+                       case 'value' :\r
+                       case 'selectedIndex' :\r
+                               if( X.Dom.Attr.HAS_VALUE[ this._tag ] ){\r
+                                       if( this._newAttrs && X.inObject( nameOrObj, this._newAttrs ) ) return this._newAttrs[ nameOrObj ];\r
+                                       if( elm = X.Dom.DOM_IE4 ? this._rawNode || this._ie4getRawNode() : this._rawNode ){\r
+                                               attrs[ nameOrObj ] = elm[ nameOrObj ]; // getAttribute( nameOrObj )?\r
+                                       };\r
+                                       return attrs[ nameOrObj ];\r
+                               };\r
+                               break;\r
                };\r
-               return attrs[ X.Dom.Attr.renameForTag[ nameOrObj ] || nameOrObj ];\r
+               return attrs && attrs[ X.Dom.Attr.renameForTag[ nameOrObj ] || nameOrObj ];\r
        };\r
 };\r
 X.Dom.Node.prototype._setAttr = function( attrs, newAttrs, name, v ){\r