File tree Expand file tree Collapse file tree 7 files changed +6798
-15
lines changed Expand file tree Collapse file tree 7 files changed +6798
-15
lines changed Original file line number Diff line number Diff line change 11{
22 "curly" : true ,
33 "latedef" : true ,
4- "quotmark" : true ,
54 "undef" : true ,
65 "unused" : true ,
76 "trailing" : true ,
Original file line number Diff line number Diff line change 1- var attrRE = / \s ( [ ^ ' " / \s > < ] + ?) [ \s / > ] | ( [ ^ \s = ] + ) = \s ? ( " .* ?" | ' .* ?' ) / g
1+ var attrRE = / \s ( [ ^ ' " / \s > < ] + ?) [ \s / > ] | ( [ ^ \s = ] + ) = \s ? ( " .* ?" | ' .* ?' ) / g;
22
33// create optimized lookup object for
44// void elements as listed here:
@@ -30,40 +30,45 @@ module.exports = function (tag) {
3030 children : [ ]
3131 } ;
3232
33- let tagMatch = tag . match ( / < \/ ? ( [ ^ \s ] + ?) [ / \s > ] / )
33+ var tagMatch = tag . match ( / < \/ ? ( [ ^ \s ] + ?) [ / \s > ] / ) ;
3434 if ( tagMatch )
3535 {
3636 res . name = tagMatch [ 1 ] ;
37- if ( lookup [ tagMatch [ 1 ] . toLowerCase ( ) ] || tag . charAt ( tag . length - 2 ) === '/' )
37+ if ( lookup [ tagMatch [ 1 ] . toLowerCase ( ) ] || tag . charAt ( tag . length - 2 ) === '/' ) {
3838 res . voidElement = true ;
39+ }
3940
4041 }
4142
42- let reg = new RegExp ( attrRE )
43- let result = null ;
43+ var reg = new RegExp ( attrRE ) ;
44+ var result = null ;
4445 for ( ; ; )
4546 {
4647 result = reg . exec ( tag ) ;
4748
48- if ( result === null )
49+ if ( result === null ) {
4950 break ;
51+ }
5052
51- if ( ! result [ 0 ] . trim ( ) )
53+ if ( ! result [ 0 ] . trim ( ) ) {
5254 continue ;
55+ }
5356
5457 if ( result [ 1 ] )
5558 {
56- let attr = result [ 1 ] . trim ( ) ;
57- let arr = [ attr , "" ] ;
59+ var attr = result [ 1 ] . trim ( ) ;
60+ var arr = [ attr , '' ] ;
5861
59- if ( attr . indexOf ( "=" ) > - 1 )
60- arr = attr . split ( "=" ) ;
62+ if ( attr . indexOf ( '=' ) > - 1 ) {
63+ arr = attr . split ( '=' ) ;
64+ }
6165
6266 res . attrs [ arr [ 0 ] ] = arr [ 1 ] ;
6367 reg . lastIndex -- ;
6468 }
65- else if ( result [ 2 ] )
69+ else if ( result [ 2 ] ) {
6670 res . attrs [ result [ 2 ] ] = result [ 3 ] . trim ( ) . substring ( 1 , result [ 3 ] . length - 1 ) ;
71+ }
6772 }
6873
6974 return res ;
Original file line number Diff line number Diff line change 11/*jshint -W030 */
2- var tagRE = / < (?: " [ ^ " ] * " [ ' " ] * | ' [ ^ ' ] * ' [ ' " ] * | [ ^ ' " > ] ) + > / g;
2+ var tagRE = / < [ a - z A - Z \- \! \/ ] (?: " [ ^ " ] * " [ ' " ] * | ' [ ^ ' ] * ' [ ' " ] * | [ ^ ' " > ] ) * > / g;
3+
34var parseTag = require ( './parse-tag' ) ;
45// re-used obj for quick lookups of components
56var empty = Object . create ? Object . create ( null ) : { } ;
You can’t perform that action at this time.
0 commit comments