Closed bjornstar closed 4 years ago
The other breaking change here is the return value of HTMLElement for dom elements like div or span. Previously it would return HTMLDivElement or HTMLSpanElement, but now they all return HTMLElement.
Can you elaborate on why we should change this? What's the benefit of just returning HTMLElement
?
The other breaking change here is the return value of HTMLElement for dom elements like div or span. Previously it would return HTMLDivElement or HTMLSpanElement, but now they all return HTMLElement.
Can you elaborate on why we should change this? What's the benefit of just returning
HTMLElement
?
The current type guard is written for the HTMLElement
type so it's consistent with what is implemented.
To be considered type safe for all 119 HTML tags would require a significant increase to the size and scope of the project.
Thanks :)
Released: https://github.com/sindresorhus/is/releases/tag/v3.0.0
This is the functional change that was removed from #113
There was an unsafe cast in getObjectType which could allow any string to be returned. This was used as an output in the primary
is
function.The primary function
is
now always returns aTypeName
.The other breaking change here is the return value of
HTMLElement
for dom elements likediv
orspan
. Previously it would returnHTMLDivElement
orHTMLSpanElement
, but now they all returnHTMLElement
.