@@ -237,12 +237,12 @@ function EasySAXParser() {
237237 , attr_list = hasSurmiseNS ? [ ] : false
238238 , name , value = ''
239239 , ok = false
240+ , noValueAttribute = false
240241 , j , w , nn , n
241242 , hasNewMatrix
242243 , alias , newalias
243244 ;
244245
245-
246246 aa:
247247 for ( ; i < l ; i ++ ) {
248248 w = s . charCodeAt ( i ) ;
@@ -251,7 +251,7 @@ function EasySAXParser() {
251251 continue
252252 } ;
253253
254- if ( ( w < 65 && w !== 40 && w !== 41 ) || // allow parens () -- used for angular syntax
254+ if ( ( w < 65 && w !== 40 && w !== 41 && w !== 35 ) || // allow parens () -- used for angular syntax
255255 w > 122 || ( w === 92 || ( w > 93 && w < 97 ) ) ) { // ожидаем символ
256256 return attr_res = false ; // error. invalid char
257257 } ;
@@ -260,21 +260,28 @@ function EasySAXParser() {
260260 w = s . charCodeAt ( j ) ;
261261
262262 if ( w > 96 && w < 123 || w > 64 && w < 91 || w > 47 && w < 59 || w === 45 || w === 95 || w === 46 /* https://github.com/telerik/xPlatCore/issues/179 */ ) {
263- continue ;
263+ if ( noValueAttribute ) {
264+ j -- ; //Started next attribute. Get back and break out of the loop.
265+ break ;
266+ } else {
267+ continue ;
268+ }
264269 } ;
265270
266- if ( w === 32 || ( w > 8 && w < 14 ) ) { // \f\n\r\t\v пробел
267- continue ;
268- } ;
269-
270- if ( w === 91 || w === 93 || w === 40 || w === 41 || w === 94 ) { // Angular special attribute chars:[]()^
271+ if ( w === 91 || w === 93 || w === 40 || w === 41 || w === 94 || w === 35 ) { // Angular special attribute chars:[]()^
271272 continue ;
272273 }
273274
274-
275- if ( w !== 61 ) { // "=" == 61
275+ if ( w === 32 || ( w > 8 && w < 14 ) ) { // \f\n\r\t\v пробел
276+ noValueAttribute = true ;
277+ continue ;
278+ } else if ( w === 61 ) { // "=" == 61
279+ noValueAttribute = false ;
280+ break ;
281+ } else {
276282 //console.log('error 2');
277- return attr_res = false ; // error. invalid char
283+ if ( ! noValueAttribute )
284+ return attr_res = false ; // error. invalid char
278285 } ;
279286
280287 break ;
@@ -298,38 +305,45 @@ function EasySAXParser() {
298305 }
299306 }
300307
301- if ( w === 34 ) { // '"'
302- j = s . indexOf ( '"' , i = j + 2 ) ;
308+ if ( ! noValueAttribute ) {
309+ if ( w === 34 ) { // '"'
310+ j = s . indexOf ( '"' , i = j + 2 ) ;
303311
304- } else {
305- if ( w === 39 ) {
306- j = s . indexOf ( '\'' , i = j + 2 ) ;
312+ } else {
313+ if ( w === 39 ) {
314+ j = s . indexOf ( '\'' , i = j + 2 ) ;
307315
308- } else { // "'"
309- //console.log(' error 3')
310- return attr_res = false ; // error. invalid char
311- } ;
312- } ;
316+ } else { // "'"
317+ return attr_res = false ; // error. invalid char
318+ } ;
319+ } ;
320+ }
313321
314322 if ( j === - 1 ) {
315323 //console.log('error 4')
316324 return attr_res = false ; // error. invalid char
317325 } ;
318326
319327
320- if ( j + 1 < l ) {
328+ if ( j + 1 < l && ! noValueAttribute ) {
321329 w = s . charCodeAt ( j + 1 ) ;
322330
323- if ( w > 32 || w < 9 || ( w < 32 && w > 13 ) ) {
331+ if ( w > 32 || w < 9 || ( w < 32 && w > 13 ) ) {
324332 // error. invalid char
325333 //console.log('error 5')
326334 return attr_res = false ;
327335 } ;
328336 } ;
329337
330338
331- value = s . substring ( i , j ) ;
332- i = j + 1 ; // след. семвол уже проверен потому проверять нужно следуюший
339+ if ( noValueAttribute ) {
340+ value = '' ;
341+ } else {
342+ value = s . substring ( i , j ) ;
343+ }
344+
345+ //i = j + 1; // след. семвол уже проверен потому проверять нужно следуюший
346+ i = j ; // след. семвол уже проверен потому проверять нужно следуюший
333347
334348 if ( isNamespace ) { //
335349 if ( hasSurmiseNS ) {
@@ -382,6 +396,7 @@ function EasySAXParser() {
382396 } ;
383397
384398 res [ name ] = value ;
399+ noValueAttribute = false ;
385400 } ;
386401
387402
0 commit comments