X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=0.6.x%2Fjs%2Fdom%2F18_XDomQuery.js;h=7dc8d9c6b1636dbeea69f1bcf07a1757b39067be;hb=c2184d5500fe31de24e248c9cdf92b31e547fd0c;hp=8a6f572581384985cb738edd43fd069595cfbbdf;hpb=66dbf0e5d806e1476e2e82f2b3ca3ceff16ecba4;p=pettanr%2FclientJs.git diff --git a/0.6.x/js/dom/18_XDomQuery.js b/0.6.x/js/dom/18_XDomQuery.js index 8a6f572..7dc8d9c 100644 --- a/0.6.x/js/dom/18_XDomQuery.js +++ b/0.6.x/js/dom/18_XDomQuery.js @@ -205,11 +205,11 @@ X.Dom.Query._parse = function( query, last ){ }; // セレクター - X.Dom.find = X._shortcut = Node.prototype.find = function( queryString ){ + X.Dom.find = X._shortcut = Node.prototype.find = X.Dom.NodeList.prototype.find = function( queryString ){ var HTML = Node._html, - scope = this.cnstructor === X.Dom.NodeList && this.length ? this : [ this.cnstructor === Node ? this : Node.root ], - parents = scope, // 探索元の親要素 - noLower = 'title id name class for href src', + scope = this.constructor === X.Dom.NodeList && this.length ? this : [ this.constructor === Node ? this : Node.root ], + parents = scope, // 探索元の親要素 XNodeList の場合あり + noLower = 'title id name class for action archive background cite classid codebase data href longdesc profile src usemap',// + X.Dom.DTD.ATTR_VAL_IS_URI.join( ' ' ), ARY_PUSH = Array.prototype.push, ret = [], // 結果要素 root = X.Dom.Node.getRoot( scope[ 0 ] ), @@ -225,16 +225,21 @@ X.Dom.Query._parse = function( query, last ){ uid, tmp, xnode, filter, key, op, val, toLower, useName, links, className, attr, flag; + /*@+debug[*/ + if( X.Dom.readyState < X.Dom.Event.XDOM_READY ){ + alert( 'not ready! use X.Dom.listenOnce( X.Dom.Event.XDOM_READY, callback )' ); + return; + }; + /*]@+debug*/ + // 文字列以外は空で返す if( typeof queryString !== 'string' ) return ret; - - xnodes = []; // 以下、パースと探索 for( ; queryString.length; ){ - console.log( 'queryString[' + queryString + ']' ); + //console.log( 'queryString[' + queryString + ']' ); // 初期化処理 if( !parsed ){ @@ -248,7 +253,7 @@ X.Dom.Query._parse = function( query, last ){ queryString = queryString.substr( parsed[ 0 ] ); parsed = parsed[ 1 ]; - console.log( 'X.Dom.Query._parse ' + parsed ); + //console.log( 'X.Dom.Query._parse ' + parsed ); if( parsed === 5 ){ isMulti = true; @@ -275,7 +280,7 @@ X.Dom.Query._parse = function( query, last ){ if( combinator !== 0 ){ parents = xnodes; xnodes = []; - console.log( 'cobinator !== 0 ' + parents.length + ' : ' + xnodes.length ); + //console.log( 'cobinator !== 0 ' + parents.length + ' : ' + xnodes.length ); }; }; @@ -326,12 +331,12 @@ X.Dom.Query._parse = function( query, last ){ default : if( combinator === 1 || ( isStart && selector < 7 ) ){ - console.log( l + ' > ' + xnodes.length + ' tag:' + tagName ); + //console.log( l + ' > ' + xnodes.length + ' tag:' + tagName ); for( ; i < l; ++i ){ xnode = parents[ i ]; xnode._xnodes && xnode._xnodes.length && X.Dom.Query._fetchElements( xnodes, xnode, isAll ? null : tagName ); }; - console.log( l + ' >> ' + xnodes.length + ' tag:' + tagName ); + //console.log( l + ' >> ' + xnodes.length + ' tag:' + tagName ); }; }; @@ -472,9 +477,9 @@ X.Dom.Query._parse = function( query, last ){ isNot = false; parsed = null; - console.log( '//end :' + ( xnodes && xnodes.length ) ); + //console.log( '//end :' + ( xnodes && xnodes.length ) ); }; - console.log( 'multi:' + ( xnodes && xnodes.length ) ); + //console.log( 'multi:' + ( xnodes && xnodes.length ) ); // tree 順に並び替え、同一要素の排除 if( isMulti ){ @@ -721,3 +726,5 @@ X.Dom.Query._filter = { } }; + +