Permalink
Browse files

Manipulation: add support to tag-hyphenated elements

Fixes #1987
Closes gh-1988
  • Loading branch information...
LeonardoBraga authored and markelog committed Jan 5, 2015
1 parent 534f130 commit 85ffc6d973865a031ded170934e0acfc2e97cb11
Showing with 19 additions and 2 deletions.
  1. +2 −2 src/manipulation.js
  2. +17 −0 test/unit/manipulation.js
View
@@ -16,8 +16,8 @@ define([
], function( jQuery, concat, push, access, rcheckableType, support, dataPriv, dataUser ) {
var
rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
rtagName = /<([\w:]+)/,
rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,
rtagName = /<([\w:-]+)/,
rhtml = /<|&#?\w+;/,
rnoInnerhtml = /<(?:script|style|link)/i,
// checked="checked" or checked
View
@@ -486,6 +486,23 @@ test( "html(String) with HTML5 (Bug #6485)", function() {
equal( jQuery("#qunit-fixture").children().children().children().length, 1, "Make sure nested HTML5 elements can hold children." );
});
test( "html(String) tag-hyphenated elements (Bug #1987)", function() {
expect( 27 );
jQuery.each( "thead tbody tfoot colgroup caption tr th td".split(" "), function( i, name ) {
var j = jQuery("<" + name + "-d></" + name + "-d><" + name + "-d></" + name + "-d>");
ok( j[0], "Create a tag-hyphenated element" );
ok( jQuery.nodeName(j[0], name.toUpperCase() + "-D"), "Hyphenated node name" );
ok( jQuery.nodeName(j[1], name.toUpperCase() + "-D"), "Hyphenated node name" );
});
var j = jQuery("<tr-multiple-hyphens><td-with-hyphen>text</td-with-hyphen></tr-multiple-hyphens>");
ok( jQuery.nodeName(j[0], "TR-MULTIPLE-HYPHENS"), "Tags with multiple hypens" );
ok( jQuery.nodeName(j.children()[0], "TD-WITH-HYPHEN"), "Tags with multiple hypens" );
equal( j.children().text(), "text", "Tags with multple hypens behave normally" );
});
test( "IE8 serialization bug", function() {
expect( 2 );

6 comments on commit 85ffc6d

@dmethvin

This comment has been minimized.

Show comment
Hide comment
@dmethvin

dmethvin Jan 13, 2015

Member

The comment here affected http://bugs.jquery.com/ticket/1987 because the commit hook for Trac is still active. (I deleted the comments there.) It's possible that we may still want to reference Trac tickets for new commits but more likely that it will just annoy us. How about if we use URLs to reference the old trac tickets in commit messages and I remove the Trac commit hook? Or if URLs are too ugly we could use trac-1987, it's pretty easy to manually construct the url from that.

Member

dmethvin replied Jan 13, 2015

The comment here affected http://bugs.jquery.com/ticket/1987 because the commit hook for Trac is still active. (I deleted the comments there.) It's possible that we may still want to reference Trac tickets for new commits but more likely that it will just annoy us. How about if we use URLs to reference the old trac tickets in commit messages and I remove the Trac commit hook? Or if URLs are too ugly we could use trac-1987, it's pretty easy to manually construct the url from that.

@markelog

This comment has been minimized.

Show comment
Hide comment
@markelog

markelog Jan 13, 2015

Member

I remove the Trac commit hook?

I think it would be best

Or if URLs are too ugly we could use trac-1987, it's pretty easy to manually construct the url from that.

Either way is sound good to me, although "use trac-1987" sounds a little bit better

Member

markelog replied Jan 13, 2015

I remove the Trac commit hook?

I think it would be best

Or if URLs are too ugly we could use trac-1987, it's pretty easy to manually construct the url from that.

Either way is sound good to me, although "use trac-1987" sounds a little bit better

@mgol

This comment has been minimized.

Show comment
Hide comment
@mgol

mgol Jan 13, 2015

Member

How about if we use URLs to reference the old trac tickets in commit messages and I remove the Trac commit hook?

+1 but we should never use # in commit messages (just gh-), leaving it for past commits or mistakes/lack of knowledge about our process of contributors.

Member

mgol replied Jan 13, 2015

How about if we use URLs to reference the old trac tickets in commit messages and I remove the Trac commit hook?

+1 but we should never use # in commit messages (just gh-), leaving it for past commits or mistakes/lack of knowledge about our process of contributors.

@dmethvin

This comment has been minimized.

Show comment
Hide comment
@dmethvin

dmethvin Jan 13, 2015

Member

I've disabled the Trac commit hook.

Member

dmethvin replied Jan 13, 2015

I've disabled the Trac commit hook.

@dmethvin

This comment has been minimized.

Show comment
Hide comment
@dmethvin

dmethvin Jan 13, 2015

Member

It would be nice to be able to move to # references at some point, it gets a bit confusing when committing to other repos.

Member

dmethvin replied Jan 13, 2015

It would be nice to be able to move to # references at some point, it gets a bit confusing when committing to other repos.

@markelog

This comment has been minimized.

Show comment
Hide comment
@markelog

markelog Jan 13, 2015

Member

it gets a bit confusing when committing to other repos.

Yeah, especially when those conventions similar but has little differences and you have to commit to those repos practically every day/week, bound to have something weird on your hands.

Member

markelog replied Jan 13, 2015

it gets a bit confusing when committing to other repos.

Yeah, especially when those conventions similar but has little differences and you have to commit to those repos practically every day/week, bound to have something weird on your hands.

Please sign in to comment.