Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Case insensitive tags #64

Merged
merged 2 commits into from
Dec 17, 2014
Merged

Case insensitive tags #64

merged 2 commits into from
Dec 17, 2014

Conversation

goetas
Copy link
Member

@goetas goetas commented Nov 24, 2014

This should fix #63, but how to apply it only to HTML5 tags, and not to XML tags?

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling ca8ed88 on goetas:i63 into f50e879 on Masterminds:master.

@zhaofengli
Copy link
Contributor

Why shouldn't it be applied to XML tags?

@goetas
Copy link
Member Author

goetas commented Nov 26, 2014

Html is case insensitive, xml not (<a>hello<A> is a syntax error)

@zhaofengli
Copy link
Contributor

Does this work? zhaofengli/html5-php@b726aeb

@goetas
Copy link
Member Author

goetas commented Dec 6, 2014

@technosophos what is your opinion about this?

@technosophos
Copy link
Member

I think @zhaofengli is on the right track, and I think $untilTag is the right thing to check.

There may be a case in SVG (@mattfarina would know) where the SVG name matches the HTML name, but I don't think that will make a significant different here.

I made a quick suggestion on the patch itself. And we should definitely write some tests to make sure this is working. But otherwise I think we should keep going with that patch.

@zhaofengli
Copy link
Contributor

@technosophos Okay, I've made zhaofengli/html5-php@d505c3f . It's a bit difficult to test the case-sensitive (non-HTML5) scenario at the moment IMO, as <title> and <textarea> are the only elements which are parsed as RCDATA, and both are HTML5 tags. Anyway, the case-insensitive scenario is already tested in @GOETA 's original patch.

@mattfarina
Copy link
Member

For reference, SVG is XML. So, it follows XML rules. HTML 5 is where things get different. There is a nice little reference on case sensitivity at http://www.w3.org/TR/html-markup/documents.html#case-insensitivity.

I remember this exact problem when we were originally writing it. I wanted to come back and fix it but never did.

Would it be worth testing that XML cases fail when the case is off? An SVG and MathML test would be useful.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) when pulling 5f39310 on goetas:i63 into f50e879 on Masterminds:master.

@goetas
Copy link
Member Author

goetas commented Dec 14, 2014

BTW, looking at DOMTreeBuilder implementation, endTag($tagName) does not check anything about the opening tag... essentialy, the opening tag capitalization always wins.

This PR will affect only rcdata tags as textarea or script tags.

@mattfarina If you are interested to have tests about failing test cases in svg or mathml, this will not affect this PR.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) when pulling 4df8acd on goetas:i63 into b39dd88 on Masterminds:master.

goetas added a commit that referenced this pull request Dec 17, 2014
Case insensitive tags
@goetas goetas merged commit 398ebb6 into Masterminds:master Dec 17, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tag names with strange capitalisation
5 participants