Skip to content

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

Closed
wants to merge 1 commit into from
Closed

Conversation

markelog
Copy link
Member

Pro - code obscuration
Con - saves some bytes

Don't know, but felt to bring this up.


2,
// Support: Android 2.3
// Android browser doesn't auto-inserts colgroup element
Copy link
Member

Choose a reason for hiding this comment

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

auto-insert

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

@dmethvin
Copy link
Member

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
Copy link
Member

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.

Copy link
Member Author

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?

Copy link
Member

Choose a reason for hiding this comment

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

http://contribute.jquery.org/style-guide/js/#comments

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: [.

Copy link
Member Author

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 :-).

http://contribute.jquery.org/style-guide/js/#comments

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

Copy link
Member

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.

Copy link
Member

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>" ],

Copy link
Member Author

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?

markelog added a commit that referenced this pull request Feb 10, 2015
Take advantage of html serialization for html wrappers - saves 26 bytes
Plus add additional test for "col" element

(cherry-picked from 0ea342a)

Closes gh-2031
Fixes gh-2002
@markelog markelog closed this in 0ea342a Feb 10, 2015
anthonyryan1 added a commit to anthonyryan1/jquery that referenced this pull request Jul 25, 2015
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
anthonyryan1 added a commit to anthonyryan1/jquery that referenced this pull request Jul 25, 2015
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
anthonyryan1 added a commit to anthonyryan1/jquery that referenced this pull request Sep 9, 2015
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
anthonyryan1 added a commit to anthonyryan1/jquery that referenced this pull request Sep 9, 2015
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
mgol pushed a commit that referenced this pull request Sep 14, 2015
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
mgol pushed a commit that referenced this pull request Sep 14, 2015
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
markelog added a commit that referenced this pull request Nov 10, 2015
Take advantage of html serialization for html wrappers - saves 26 bytes
Plus add additional test for "col" element

Closes gh-2031
Fixes gh-2002
@lock lock bot locked as resolved and limited conversation to collaborators Jan 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants