X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;ds=sidebyside;f=0.6.x%2Fjs%2F02_dom%2F08_XNodeSelector.js;h=793e166cc5cbf84bfeba8822ca8604c54c12e0b6;hb=3256f11c856314a1425b8459b9d000a88caf8258;hp=cbe562178fc5e989aaebfa5fb3a964dfedad64a8;hpb=9f5ab564d20a8bd6438693146ae73209c78a2c5e;p=pettanr%2FclientJs.git diff --git a/0.6.x/js/02_dom/08_XNodeSelector.js b/0.6.x/js/02_dom/08_XNodeSelector.js index cbe5621..793e166 100644 --- a/0.6.x/js/02_dom/08_XNodeSelector.js +++ b/0.6.x/js/02_dom/08_XNodeSelector.js @@ -56,7 +56,10 @@ var // TODO { a : 1, A : 2, _ : 3,,, } X_Node_Selector__ALPHABET = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-0123456789\\', X_Node_Selector__NUMBER = '+-0123456789'; - + +// XMLWrapper のために今だけ外部に公開 +X_NodeSelector_parse = X_Node_Selector__parse; + /* * セレクタ文字列の解析、但し一挙に行わず、ひと塊づつ * 結合子 + 単体セレクタ( タグ,*,#,.,[],: ) @@ -181,16 +184,22 @@ function X_Node_Selector__parse( query, last ){ break; default : }; + + if( phase === 0xf ) return i; + //alert( chr + ' ' + phase + ' ' + selector + ' ' + name + ' ' + name1st ) if( phase === 0xe ){ if( selector === 4 ){// :not if( name === 'not' ){ - if( not ) return i; // error - not = true; - selector = 0; - phase = 0x0; - name = null; - continue; + if( not ){ + return i; // error + } else { + not = true; + selector = 0; + phase = 0x0; + name = null; + }; + //continue; } else if( name === 'lang' || name === 'contains' ){ result = [ not ? 0 : combinator, selector, name, value ]; @@ -200,16 +209,16 @@ function X_Node_Selector__parse( query, last ){ result = [ not ? 0 : combinator, selector, name, a, b ]; break; }; + } else { + result = + combinator === 5 ? + 5 : + selector === 5 ? + [ not ? 0 : combinator, selector, key, operator, value ] : + [ not ? 0 : combinator, selector, name.split( '\\' ).join( '' ) ]; + break; }; - result = - combinator === 5 ? - 5 : - selector === 5 ? - [ not ? 0 : combinator, selector, key, operator, value ] : - [ not ? 0 : combinator, selector, name.split( '\\' ).join( '' ) ]; - break; - } else - if( phase === 0xf ) return i; + }; escape = chr === '\\' && !escape; }; @@ -219,7 +228,7 @@ function X_Node_Selector__parse( query, last ){ }; // セレクター - X.Doc.find = X._shortcut = Node.prototype.find = X_NodeList.prototype.find = function( queryString ){ + X.Doc.find = X_shortcutFunction = Node.prototype.find = X_NodeList.prototype.find = function ( queryString ){ var HTML = X_Node_html, scope = this.constructor === X_NodeList && this.length ? this : [ this.constructor === Node ? this : X_Node_body ], parents = scope, // 探索元の親要素 XNodeList の場合あり @@ -440,7 +449,7 @@ function X_Node_Selector__parse( query, last ){ // 諦めて、funcAttrを呼ぶ // flag_call = ($.browser.safari && key === 'selected'); // getAttributeを使わない - useName = X.UA.IE && key !== 'href' && key !== 'src'; + useName = X_UA.IE && key !== 'href' && key !== 'src'; toLower = !!val && !isXML && noLower.indexOf( key ) === -1; //!noLower.test(key); if( toLower ) val = val.toLowerCase(); if( op === 3 ) val = _ + val + _;