Skip to content
This repository has been archived by the owner on Mar 28, 2019. It is now read-only.

added </option> as an optional ommited end tag #81

Open
wants to merge 3 commits into
base: gh-pages
Choose a base branch
from

Conversation

pollei
Copy link

@pollei pollei commented Sep 8, 2015

as per http://www.w3.org/TR/html5/syntax.html#optional-tags
modified: src/HTMLParser.js
modified: test/test-slowparse.js

  as per http://www.w3.org/TR/html5/syntax.html#optional-tags
	modified:   src/HTMLParser.js
	modified:   test/test-slowparse.js
"rtc": ["rb","rtc","rp"],
"rp": ["rb","rt","rtc","rp"],
"optgroup": ["optgroup"],
"option": ["option"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or may also be followed by an "optgroup"

@Pomax
Copy link
Contributor

Pomax commented Sep 11, 2015

super-thanks for adding those! A few notes on the PR though, mostly the fact that you added more than just option means we'll need tests for the other optional tag elements, too.

@pollei
Copy link
Author

pollei commented Sep 12, 2015

OK I'll add more test cases, and I'll work to make them pass. Right now they will definitely fail if I'm reading the code correctly; I added them to high-light incompleteness. So I'll make tests for "tr", "optgroup" and the ruby stuff, etc.

I have no real clue about ruby. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ruby however I can find some examples and adapt them as tests. I'll cross-check with https://validator.w3.org/ .

https://bugzilla.mozilla.org/show_bug.cgi?id=946393 "Allow optional omittable close tags according to the W3C HTML5 standards"
I'll also add tests for "dd" and "dt" to help close this bug on thimble. It's an old one from 2013-12-04 .
Then thimble would have to update their package.json as they have "slowparse": "1.1.3" . and you are now 1.1.4 . likely you should go to version 1.1.5 soon.

50% chance I'll have another patch ready to review by end of tomorrow, 95% chance by Monday.

@Pomax
Copy link
Contributor

Pomax commented Sep 12, 2015

Thimble just relaunched a completely overhaul on thimble.mozilla.org, using a codebase that isn't making use of Slowparse at the moment, but adding it back in does seem on their roadmap from what I can tell.

@humphd
Copy link

humphd commented Sep 12, 2015

Indeed, I expect Slowparse to rejoin Thimble soon. We just lack elegant UI, but patches like this make the backend something to be desired.

fixed dd and dt as per https://bugzilla.mozilla.org/show_bug.cgi?id=946393
got some ruby working
added more tests of omitable tags; 6 of which currently fail
  they fail because omitable tags may nest so more care is needed

* modified:   src/HTMLParser.js
* modified:   test/test-slowparse.js
@pollei
Copy link
Author

pollei commented Sep 21, 2015

fixed dd and dt as per https://bugzilla.mozilla.org/show_bug.cgi?id=946393

<dl><dt>Coffee<dd>Black hot drink<dt>Milk<dd>White cold drink</dl>

got some ruby working

<ruby><rp>(<rt>Kan<rp>)</rp><rp>(<rt>ji<rp>)</ruby>

added more tests of omitable tags; 6 of which currently fail
they fail because omitable tags may nest so more care is needed

<select><optgroup label="X"><option>V<option>S<optgroup label="Z"><option>M<option>A</select>
<table><thead><tr><td><tbody><tr><td><tr><td><tfoot></table>
<ruby><rb>10<rb>31<rb>2002<rtc><rt>Month<rt>Day<rt>Year<rtc><rt>Expiration Date</ruby>

For example when optgroup Z is started option S and optgroup X both need to end.
In the table example I show that this nesting can be 3 levels easily.

I'll need more work to make them pass. I've been reading through to see where I might need to add some loops and extra tests etc. It might be next weekend before I can try again.

I am happy Thimble can use slowparse again; I might slowly add things to it. My interest is mostly in https://github.com/Khan/live-editor as I use their website a bit https://www.khanacademy.org/profile/spollei/ .

  • modified: src/HTMLParser.js
  • modified: test/test-slowparse.js

@Pomax
Copy link
Contributor

Pomax commented Sep 23, 2015

hm, in that case it's probably worth landing all of these separately, so that things that already work can be merged in, and things that require code changes so the tests pass can be worked on without holding up the other elements.

…blems

down to 2 failures instead of 6
	modified:   src/DOMBuilder.js
	modified:   src/HTMLParser.js
@pollei
Copy link
Author

pollei commented Oct 5, 2015

OK I was able to work on it again this weekend, but not finish it. down to only two failures.
Most likely _popOmited is badly broken ... Hopefully next weekend, I'll have chance to debug things, and clean up some cruft.

@@ -35,6 +35,12 @@ module.exports = (function(){
popElement: function() {
this.currentNode = this.currentNode.parentNode;
},
popElements: function(n) {
while (n>0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since we're terminating on n=0, we can say while(n--) here, so that we don't need the decrement in the body.

@Pomax
Copy link
Contributor

Pomax commented Oct 5, 2015

So awsome! Looking forward to next weekend's result =D

@flukeout
Copy link

Hey @pollei - it's only been two years, but guess what, we're adding Slowparse back to Thimble! You can check out the tracking issue here: mozilla/brackets#876

Any chance that you are still going to finish this PR? Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants