This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree 2 files changed +30
-3
lines changed
2 files changed +30
-3
lines changed Original file line number Diff line number Diff line change @@ -151,10 +151,10 @@ function camelCase(name) {
151
151
replace ( MOZ_HACK_REGEXP , 'Moz$1' ) ;
152
152
}
153
153
154
- var SINGLE_TAG_REGEXP = / ^ < ( \w + ) \s * \/ ? > (?: < \/ \1> | ) $ / ;
154
+ var SINGLE_TAG_REGEXP = / ^ < ( [ \w - ] + ) \s * \/ ? > (?: < \/ \1> | ) $ / ;
155
155
var HTML_REGEXP = / < | & # ? \w + ; / ;
156
- var TAG_NAME_REGEXP = / < ( [ \w : ] + ) / ;
157
- var XHTML_TAG_REGEXP = / < (? ! a r e a | b r | c o l | e m b e d | h r | i m g | i n p u t | l i n k | m e t a | p a r a m ) ( ( [ \w : ] + ) [ ^ > ] * ) \/ > / gi;
156
+ var TAG_NAME_REGEXP = / < ( [ \w : - ] + ) / ;
157
+ var XHTML_TAG_REGEXP = / < (? ! a r e a | b r | c o l | e m b e d | h r | i m g | i n p u t | l i n k | m e t a | p a r a m ) ( ( [ \w : - ] + ) [ ^ > ] * ) \/ > / gi;
158
158
159
159
var wrapMap = {
160
160
'option' : [ 1 , '<select multiple="multiple">' , '</select>' ] ,
Original file line number Diff line number Diff line change @@ -78,6 +78,33 @@ describe('jqLite', function() {
78
78
} ) ;
79
79
80
80
81
+ // This is not working correctly in jQuery prior to v3.0.
82
+ // See https://github.com/jquery/jquery/issues/1987 for details.
83
+ it ( 'should properly handle dash-delimited node names' , function ( ) {
84
+ var jQueryVersion = window . jQuery && window . jQuery . fn . jquery . split ( '.' ) [ 0 ] ;
85
+ var jQuery3xOrNewer = jQueryVersion && ( Number ( jQueryVersion ) >= 3 ) ;
86
+
87
+ if ( _jqLiteMode || jQuery3xOrNewer ) {
88
+ var nodeNames = 'thead tbody tfoot colgroup caption tr th td div kung' . split ( ' ' ) ;
89
+ var nodeNamesTested = 0 ;
90
+ var nodes , customNodeName ;
91
+
92
+ forEach ( nodeNames , function ( nodeName ) {
93
+ var customNodeName = nodeName + '-foo' ;
94
+ var nodes = jqLite ( '<' + customNodeName + '>Hello, world !</' + customNodeName + '>' ) ;
95
+
96
+ expect ( nodes . length ) . toBe ( 1 ) ;
97
+ expect ( nodeName_ ( nodes ) ) . toBe ( customNodeName ) ;
98
+ expect ( nodes . html ( ) ) . toBe ( 'Hello, world !' ) ;
99
+
100
+ nodeNamesTested ++ ;
101
+ } ) ;
102
+
103
+ expect ( nodeNamesTested ) . toBe ( 10 ) ;
104
+ }
105
+ } ) ;
106
+
107
+
81
108
it ( 'should allow creation of comment tags' , function ( ) {
82
109
var nodes = jqLite ( '<!-- foo -->' ) ;
83
110
expect ( nodes . length ) . toBe ( 1 ) ;
You can’t perform that action at this time.
0 commit comments