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

HTMLTableDataCellElement and HTMLTableHeaderCellElement are no longer in spec. #130

Open
keithamus opened this issue Dec 4, 2017 · 0 comments

Comments

@keithamus
Copy link
Member

keithamus commented Dec 4, 2017

We have specific conformance checks for td elements being HTMLTableDataCellElement and th being HTMLTableHeaderCellElement - as per what was (at the time) the WHATWG Spec.

However the WHATWG Spec has been aligned to the browsers (see whatwg/html#1125, whatwg/html#1115) and any implementation that was destined to reflect this has backed out. So we should too.

Proposal is to remove both of these conformance checks and change the tests to reflect this.

Relevant LOC:

type-detect/index.js

Lines 177 to 207 in f79e0e4

/* ! Spec Conformance
* (https://html.spec.whatwg.org/#htmltabledatacellelement)
* WhatWG HTML$4.9.9 - The `td` element - Interface `HTMLTableDataCellElement`
* Note: Most browsers currently adher to the W3C DOM Level 2 spec
* (https://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-82915075)
* which suggests that browsers should use HTMLTableCellElement for
* both TD and TH elements. WhatWG separates these.
* Test: Object.prototype.toString.call(document.createElement('td'))
* - Chrome === "[object HTMLTableCellElement]"
* - Firefox === "[object HTMLTableCellElement]"
* - Safari === "[object HTMLTableCellElement]"
*/
if (obj instanceof globalObject.HTMLElement && obj.tagName === 'TD') {
return 'HTMLTableDataCellElement';
}
/* ! Spec Conformance
* (https://html.spec.whatwg.org/#htmltableheadercellelement)
* WhatWG HTML$4.9.9 - The `td` element - Interface `HTMLTableHeaderCellElement`
* Note: Most browsers currently adher to the W3C DOM Level 2 spec
* (https://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-82915075)
* which suggests that browsers should use HTMLTableCellElement for
* both TD and TH elements. WhatWG separates these.
* Test: Object.prototype.toString.call(document.createElement('th'))
* - Chrome === "[object HTMLTableCellElement]"
* - Firefox === "[object HTMLTableCellElement]"
* - Safari === "[object HTMLTableCellElement]"
*/
if (obj instanceof globalObject.HTMLElement && obj.tagName === 'TH') {
return 'HTMLTableHeaderCellElement';
}

These two tests will need to change (but we should keep them):

type-detect/test/dom.js

Lines 286 to 292 in f79e0e4

it('HTMLTableDataCellElement', () => {
assert(type(document.createElement('TD')) === 'HTMLTableDataCellElement');
});
it('HTMLTableHeaderCellElement', () => {
assert(type(document.createElement('TH')) === 'HTMLTableHeaderCellElement');
});

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

No branches or pull requests

1 participant