Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(213)

Issue 11888019: Fix new Element.html with tables in IE (Closed)

Created:
7 years, 11 months ago by Jennifer Messerly
Modified:
7 years, 11 months ago
Reviewers:
Emily Fortuna, blois
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Fix new Element.html with tables in IE http://dartbug.com/7902 Committed: https://code.google.com/p/dart/source/detail?r=17104

Patch Set 1 #

Patch Set 2 : #

Total comments: 14

Patch Set 3 : updated #

Unified diffs Side-by-side diffs Delta from patch set Stats (+372 lines, -27 lines) Patch
M sdk/lib/html/dart2js/html_dart2js.dart View 3 chunks +83 lines, -9 lines 0 comments Download
M sdk/lib/html/dartium/html_dartium.dart View 3 chunks +83 lines, -9 lines 0 comments Download
M tests/html/element_test.dart View 1 chunk +123 lines, -0 lines 0 comments Download
M tools/dom/templates/html/impl/impl_Element.darttemplate View 1 2 3 chunks +83 lines, -9 lines 0 comments Download

Messages

Total messages: 7 (0 generated)
Jennifer Messerly
This change fixes "new Element.html" in tables in IE. Basically, we workaround innerHTML in tables ...
7 years, 11 months ago (2013-01-15 05:23:11 UTC) #1
blois
For testing, I just have a server on my Linux box at my Dart root ...
7 years, 11 months ago (2013-01-15 17:54:41 UTC) #2
Emily Fortuna
https://codereview.chromium.org/11888019/diff/1005/tools/dom/templates/html/impl/impl_Element.darttemplate File tools/dom/templates/html/impl/impl_Element.darttemplate (right): https://codereview.chromium.org/11888019/diff/1005/tools/dom/templates/html/impl/impl_Element.darttemplate#newcode890 tools/dom/templates/html/impl/impl_Element.darttemplate:890: if (_TABLE_TAGS.containsKey(tag) && this is super nit-picky, but consider ...
7 years, 11 months ago (2013-01-15 20:06:27 UTC) #3
Emily Fortuna
https://codereview.chromium.org/11888019/diff/1005/tools/dom/templates/html/impl/impl_Element.darttemplate File tools/dom/templates/html/impl/impl_Element.darttemplate (right): https://codereview.chromium.org/11888019/diff/1005/tools/dom/templates/html/impl/impl_Element.darttemplate#newcode937 tools/dom/templates/html/impl/impl_Element.darttemplate:937: case 'tbody': element = _singleNode(table.tBodies); break; also, I'm not ...
7 years, 11 months ago (2013-01-15 20:07:22 UTC) #4
Jennifer Messerly
thanks! https://codereview.chromium.org/11888019/diff/1005/tools/dom/templates/html/impl/impl_Element.darttemplate File tools/dom/templates/html/impl/impl_Element.darttemplate (right): https://codereview.chromium.org/11888019/diff/1005/tools/dom/templates/html/impl/impl_Element.darttemplate#newcode891 tools/dom/templates/html/impl/impl_Element.darttemplate:891: window.navigator.userAgent.contains('MSIE')) { On 2013/01/15 17:54:41, blois wrote: > ...
7 years, 11 months ago (2013-01-15 20:11:28 UTC) #5
Jennifer Messerly
https://codereview.chromium.org/11888019/diff/1005/tools/dom/templates/html/impl/impl_Element.darttemplate File tools/dom/templates/html/impl/impl_Element.darttemplate (right): https://codereview.chromium.org/11888019/diff/1005/tools/dom/templates/html/impl/impl_Element.darttemplate#newcode890 tools/dom/templates/html/impl/impl_Element.darttemplate:890: if (_TABLE_TAGS.containsKey(tag) && On 2013/01/15 20:06:27, Emily Fortuna wrote: ...
7 years, 11 months ago (2013-01-15 20:41:21 UTC) #6
blois
7 years, 11 months ago (2013-01-15 20:47:51 UTC) #7
lgtm

https://codereview.chromium.org/11888019/diff/1005/tools/dom/templates/html/i...
File tools/dom/templates/html/impl/impl_Element.darttemplate (right):

https://codereview.chromium.org/11888019/diff/1005/tools/dom/templates/html/i...
tools/dom/templates/html/impl/impl_Element.darttemplate:952: return
_singleNode(table.children.where((n) => n.tagName == 'COLGROUP')
On 2013/01/15 20:11:28, John Messerly wrote:
> On 2013/01/15 17:54:41, blois wrote:
> > Use n is TableColElement instead?
> 
> I was thinking tagName might be faster than doing an "is" check in JS (which
> IIRC is a bit complicated for DOM elements). Also TableColElement is shared by
> "col" and "colgroup" (here we should only get colgroup, but it makes me a
little
> nervous). Is there any reason to avoid .tagName? It seems like a nice way to
> guarentee we get exactly the tag we expect.
> 
> In general we haven't been using tagName much
> > at all.
> > 
> > Alternatively, table.query('colgroup')?
> 
> Was trying to avoid query/queryAll because it might return something in the
> subtree, and it's more expensive (query whole subtree)

Checking the tagname is fine. I believe that the 'is' check is fairly cheap in
dart2js right now- it's just an overloaded is$TableColElement function that
returns true on TableColElement (though still not as cheap as comparing strings,
but probably within the noise level).

https://codereview.chromium.org/11888019/diff/1005/tools/dom/templates/html/i...
tools/dom/templates/html/impl/impl_Element.darttemplate:956: static Node
_singleNode(List<Node> list) {
On 2013/01/15 20:11:28, John Messerly wrote:
> On 2013/01/15 17:54:41, blois wrote:
> > List.single instead?
> 
> Thought about that. It would certainly be cleaner (I could delete this
> function). But we wouldn't get the nice error message, instead just a generic
> StateError. Does it matter? WDYT?

I suppose it probably is one of the more common mistakes someone would make with
this API, so OK as is.

Powered by Google App Engine
This is Rietveld 408576698