Skip to content

HTMLTableDataCellElement and HTMLTableHeaderCellElement are no longer in spec. #130

Open
@keithamus

Description

@keithamus

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');
});

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions