Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 7635017

Browse files
committedJan 2, 2015
fix(jqLite): properly handle dash-delimited node names in jqLiteBuildFragment
Closes angular#10617
1 parent 66ceecc commit 7635017

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed
 

‎src/jqLite.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ function camelCase(name) {
142142

143143
var SINGLE_TAG_REGEXP = /^<(\w+)\s*\/?>(?:<\/\1>|)$/;
144144
var HTML_REGEXP = /<|&#?\w+;/;
145-
var TAG_NAME_REGEXP = /<([\w:]+)/;
145+
var TAG_NAME_REGEXP = /<([\w:-]+)/;
146146
var XHTML_TAG_REGEXP = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi;
147147

148148
var wrapMap = {

‎test/jqLiteSpec.js

+13
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,19 @@ describe('jqLite', function() {
7878
});
7979

8080

81+
it('should properly handle dash-delimited node names', function() {
82+
var nodes = jqLite('<custom-element>Hello, world !</custom-element>');
83+
expect(nodes.length).toBe(1);
84+
expect(nodes[0].nodeName.toLowerCase()).toBe('custom-element');
85+
expect(nodes[0].innerHTML).toBe('Hello, world !');
86+
87+
nodes = jqLite('<tr-custom>Hello, world !</tr-custom>');
88+
expect(nodes.length).toBe(1);
89+
expect(nodes[0].nodeName.toLowerCase()).toBe('tr-custom');
90+
expect(nodes[0].innerHTML).toBe('Hello, world !');
91+
});
92+
93+
8194
it('should allow creation of comment tags', function() {
8295
var nodes = jqLite('<!-- foo -->');
8396
expect(nodes.length).toBe(1);

0 commit comments

Comments
 (0)
Please sign in to comment.