aFarkas / html5shiv

This script is the defacto way to enable use of HTML5 sectioning elements in legacy Internet Explorer.
http://paulirish.com/2011/the-history-of-the-html5-shiv/
9.89k stars 2.56k forks source link

Support tag names with colons like foo:bar #134

Closed imjoshdean closed 10 years ago

imjoshdean commented 10 years ago

createDocumentFragment doesn't support namespaced tag names such as "mj:pane." This can be fixed by changing

getElements().join().replace(/[\w\-]+/g, function(nodeName) {

to

getElements().join().replace(/[\w\-|\w\:]+/g, function(nodeName) {

This is a bit more elegant solution than proposed in #115 as that allowed anything to be tags whereas this just allowed hyphenated tags and namespaced tags.

WanderingZombie commented 10 years ago

@imjoshdean puzzled as to why you're allowing the vertical bar | as a valid character?

imjoshdean commented 10 years ago

@WanderingZombie You're right, the proper regex for that should be

/([\w\-]|[\w\:])+/g

Fixing.

aFarkas commented 10 years ago

@imjoshdean

This could also work, I think:

/[\w\-\w\:]+/g

Would you also consider to update the printshiv version? Thx.

imjoshdean commented 10 years ago

@aFarkas Consider it done. Also, that does work and is a little shorter.

WanderingZombie commented 10 years ago

@aFarkas /[\w\-:]+/g would be the winner on brevity I think?

aFarkas commented 10 years ago

@WanderingZombie

Yes. Can I have a PR!?! :-D