リビジョン | d56e8cc1e13089eb6cbc9dcc6900d7f1828b93df (tree) |
---|---|
日時 | 2016-11-08 13:17:44 |
作者 | itozyun <itozyun@user...> |
コミッター | itozyun |
Version 0.6.220, Fix the bug of X.HTMLParser.
@@ -20,7 +20,7 @@ X_ViewPort[ 'listenOnce' ]( X_EVENT_INIT, function(){ | ||
20 | 20 | X_Node_BoxModel.CONTENT_BOX; |
21 | 21 | |
22 | 22 | if( X_Node_BoxModel_defaultBoxModel === X_Node_BoxModel.CONTENT_BOX ){ |
23 | - X_Node_BoxModel_boxSizingEnabled = node[ 'cssText' ]( 'width:10px;padding:1px;border:2px solid #0;margin:4px;' + | |
23 | + X_Node_BoxModel_boxSizingEnabled = node[ 'cssText' ]( 'width:10px;padding:1px;border:2px solid red;margin:4px;' + | |
24 | 24 | 'box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;-o-box-sizing:border-box;-ms-box-sizing:border-box;' ) |
25 | 25 | [ 'width' ]() === 10; |
26 | 26 | }; |
@@ -190,7 +190,7 @@ function X_Node_attr( nameOrObj /* v */ ){ | ||
190 | 190 | }; |
191 | 191 | return this; |
192 | 192 | } else |
193 | - if( typeof nameOrObj === 'string' ){ | |
193 | + if( X_Type_isString( nameOrObj ) ){ | |
194 | 194 | // getter |
195 | 195 | switch( nameOrObj ){ |
196 | 196 | case 'id' : |
@@ -59,12 +59,12 @@ var X_HTMLParser_CHARS = { | ||
59 | 59 | lastHtml = html, |
60 | 60 | chars, last, text, index; |
61 | 61 | |
62 | - while ( html ) { | |
62 | + while( html ){ | |
63 | 63 | chars = true; |
64 | 64 | last = stack[ stack.length - 1 ]; |
65 | 65 | |
66 | 66 | // Make sure we're not in a script or style element |
67 | - if ( last && special[ handler.isXML ? last.toUpperCase() : last ] === 1 ) { | |
67 | + if( last && special[ handler.isXML ? last.toUpperCase() : last ] === 1 ){ | |
68 | 68 | if( 0 <= ( index = html.toUpperCase().indexOf( '</' + ( handler.isXML ? last.toUpperCase() : last ) ) ) ){ |
69 | 69 | handler.chars( html.substring( 0, index ) ); |
70 | 70 | if( index = X_HTMLParser__parseEndTag( stack, handler, html ) ){ |
@@ -79,22 +79,22 @@ var X_HTMLParser_CHARS = { | ||
79 | 79 | }; |
80 | 80 | } else { |
81 | 81 | // Comment |
82 | - if ( html.indexOf("<!--") === 0 ) { | |
83 | - if ( 0 < ( index = html.indexOf("-->") ) ) { | |
82 | + if( html.indexOf("<!--") === 0 ){ | |
83 | + if( 0 < ( index = html.indexOf("-->") ) ){ | |
84 | 84 | handler.comment( html.substring( 4, index ) ); |
85 | 85 | html = html.substring( index + 3 ); |
86 | 86 | chars = false; |
87 | 87 | }; |
88 | 88 | |
89 | 89 | // end tag |
90 | - } else if ( html.indexOf("</") === 0 ) { | |
91 | - if ( 2 < ( index = X_HTMLParser__parseEndTag( stack, handler, html ) ) ) { | |
90 | + } else if( html.indexOf("</") === 0 ){ | |
91 | + if( 2 < ( index = X_HTMLParser__parseEndTag( stack, handler, html ) ) ){ | |
92 | 92 | html = html.substring( index ); |
93 | 93 | chars = false; |
94 | 94 | }; |
95 | 95 | |
96 | 96 | // start tag |
97 | - } else if ( html.indexOf("<") === 0 ) { | |
97 | + } else if( html.indexOf("<") === 0 ){ | |
98 | 98 | if( index = X_HTMLParser__parseStartTag( stack, last, handler, html ) ){ |
99 | 99 | html = html.substring( index ); |
100 | 100 | chars = false; |
@@ -104,7 +104,7 @@ var X_HTMLParser_CHARS = { | ||
104 | 104 | }; |
105 | 105 | }; |
106 | 106 | |
107 | - if ( chars ) { | |
107 | + if( chars ){ | |
108 | 108 | index = html.indexOf("<"); |
109 | 109 | |
110 | 110 | text = index < 0 ? html : html.substring( 0, index ); |
@@ -171,14 +171,16 @@ var X_HTMLParser_CHARS = { | ||
171 | 171 | case 4 : // 属性名の終わりを待つ |
172 | 172 | chr === '=' ? |
173 | 173 | ( ( phase = 6 ) && ( attrName = html.substring( start, i ) ) ) : |
174 | - ( whiteSpace[ chr ] & 16 ) && | |
175 | - ( ( phase = 5 ) && ( attrName = html.substring( start, i ) ) ); | |
174 | + ( whiteSpace[ chr ] & 16 ) ? | |
175 | + ( ( phase = 5 ) && ( attrName = html.substring( start, i ) ) ) : | |
176 | + ( chr === '>' || ( empty = html.substr( i, 2 ) === '/>' ) ) && | |
177 | + ( ( phase = 9 ) && ( attrs[ attrs.length ] = html.substring( start, i ) ) ); | |
176 | 178 | break; |
177 | 179 | case 5 : // 属性の = または次の属性または htmlタグの閉じ |
178 | 180 | !( whiteSpace[ chr ] & 16 ) &&// ie4 未対応の属性には cite = http:// となる |
179 | 181 | // 1 : |
180 | 182 | ( alphabets[ chr ] & 3 ) ? |
181 | - ( ( phase = 4 ) && ( attrs[ attrs.length ] = attrName ) && ( start = i ) ) : | |
183 | + ( ( phase = 3 ) && ( attrs[ attrs.length ] = attrName ) && ( start = i ) ) : // <textarea readonly> | |
182 | 184 | chr === '=' ? |
183 | 185 | ( phase = 6 ) : |
184 | 186 | ( chr === '>' || ( empty = html.substr( i, 2 ) === '/>' ) ) && |
@@ -199,7 +201,7 @@ var X_HTMLParser_CHARS = { | ||
199 | 201 | ( chr === '>' ) ? |
200 | 202 | ( ( phase = 9 ) && saveAttr( attrs, attrName, html.substring( start, i ) ) ) : |
201 | 203 | !escape && !uri[ attrName ] && ( empty = html.substr( i, 2 ) === '/>' ) && // attr の val が uri で / で終わりかつ、未対応属性の場合 |
202 | - ( phase = 9 ); | |
204 | + ( ( phase = 9 ) && saveAttr( attrs, attrName, html.substring( start, i ) ) ); | |
203 | 205 | break; |
204 | 206 | }; |
205 | 207 | escape = chr === '\\' && !escape; // \\\\ is not escape for " |