-
Notifications
You must be signed in to change notification settings - Fork 20.6k
Manipulation: simplify html wrappers #2031
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
Conversation
|
||
2, | ||
// Support: Android 2.3 | ||
// Android browser doesn't auto-inserts colgroup element |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
auto-insert
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
Sure, why not? The comments make it clear what cases we still have to fix, which is helpful. |
Take advantage of html serialization for html wrappers - saves 26 bytes Plus add additional test for "col" element
], | ||
|
||
tr: [ | ||
2, // - auto-inserts "tbody" element |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment and the one below should have lines of their own.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could provide the full code-example how you would like it to look?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm actually not sure, because it isn't clear if these are continuations of the "Support: Android 2.3". But a minimal change from what's here would look like:
tr: [
// - auto-inserts "tbody" element
2,
"<table>", "</table>"
],
Though I also think the comments would make more sense a level up, above the tagName: [
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm actually not sure
Yep, me too, hence the question :-).
Yeah, checked that, you example is also not applicable, since
Comments are always preceded by a blank line
So it sounds like, this should look like this -
// Following wrappers are not fully defined because
// their parent elements (except for "table" element) could be omitted
// since browser parsers are smart enough to auto-insert them
// Support: Android 2.3
// Android browser doesn't auto-insert colgroup element
col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
...
// - auto-inserts "tbody" and "tr" elements
td: [ 3, "<table>", "</table>" ],
Which i guess is fine, but less obvious
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In these cases we should ask, "What would JSCS do?" 😺
I would remove the leading -
for the td
case, but otherwise I think the less-spaced-out version is nicer to read.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you misunderstood. Assuming auto-inserts "tbody" element
and auto-inserts "tbody" and "tr" elements
are not also limited to Android 2.3, I would expect something like this:
thead: [ 1, "<table>", "</table>" ],
// Browsers auto-insert tbody
tr: [ 2, "<table>", "</table>" ],
// Browsers auto-insert tbody and tr
td: [ 3, "<table>", "</table>" ],
// Support: Android <=2.3 only
// Android browser doesn't auto-insert colgroup
col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what significant diff here is, but sure, let's do it like that.
are not also limited to Android 2.3
Don't know about previous version of Android and honestly, don't want to know :-). We have established support comments style right?
While we can reply on parsers that were designed to cope with malformed syntax to understand what we mean, we shouldn't intenitonally provide bad markup, not all parsers will accept it. "Be conservative in what you do, be liberal in what you accept from others." Reverts 0ea342a See also jquerygh-2031, jquerygh-2002 Closes jquerygh-2493
While we can reply on parsers that were designed to cope with malformed syntax to understand what we mean, we shouldn't intentionally provide bad markup, not all parsers will accept it. "Be conservative in what you do, be liberal in what you accept from others." Reverts 0ea342a See also jquerygh-2031, jquerygh-2002 Closes jquerygh-2493
While we can reply on parsers that were designed to cope with malformed syntax to understand what we mean, we shouldn't intentionally provide bad markup, not all parsers will accept it. "Be conservative in what you do, be liberal in what you accept from others." Reverts 0ea342a See also jquerygh-2031, jquerygh-2002 Closes jquerygh-2493
While we can reply on parsers that were designed to cope with malformed syntax to understand what we mean, we shouldn't intentionally provide bad markup, not all parsers will accept it. "Be conservative in what you do, be liberal in what you accept from others." Reverts 0ea342a See also jquerygh-2031, jquerygh-2002 Closes jquerygh-2493
While we can reply on parsers that were designed to cope with malformed syntax to understand what we mean, we shouldn't intentionally provide bad markup, not all parsers will accept it. "Be conservative in what you do, be liberal in what you accept from others." Reverts 0ea342a Refs gh-2031 Refs gh-2002 Fixes gh-2493 Closes gh-2499
While we can reply on parsers that were designed to cope with malformed syntax to understand what we mean, we shouldn't intentionally provide bad markup, not all parsers will accept it. "Be conservative in what you do, be liberal in what you accept from others." (cherry-picked from 99e8ff1) Reverts 0ea342a Refs gh-2031 Refs gh-2002 Fixes gh-2493 Closes gh-2499
Pro - code obscuration
Con - saves some bytes
Don't know, but felt to bring this up.