-
-
Notifications
You must be signed in to change notification settings - Fork 699
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
Remove outerHTML
fallback from inspect
#840
Conversation
var isDOMElement = function (object) { | ||
if (typeof HTMLElement === 'object') { | ||
function isDOMElement(object) { | ||
if (typeof HTMLElement !== 'undefined') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because of Custom Elements V1, HTMLElement
is reported as function
in newest Chrome and Firefox.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if HTMLElement
is undefined
?
The MDN docs aren't very clear about which browsers support this or not, there's a lot of ?
on the compatibility table.
LGTM (and I appreciate separate commits for each distinct change being made). |
Hi @shvaikalesh, thanks for the work! This seems awesome (as it always does on your PRs) 😄 Since the Regarding the checks for the HTMLElement, I'm not sure we should totally remove that. I've taken a look at the MDN page for those and it isn't clear which browsers support it and which don't. However, if you have any more info on this I'd be happy to learn about it 😄 Also, is there any special reason for us to be using those additional checks for |
@lucasfcosta Doing Array.isArray(obj) || toString.call(obj) === '[object Array]' is kinda dangerous, it gives false positive for |
@shvaikalesh thanks for the explanation, it looks clear to me now! So, if Also, I feel like Also, thanks again for this work, it's looking great! I'm impressed by your knowledge about browser supports 😄 |
We need Displaying I think |
We have type-detect for exactly this kind of stuff. If type-detect isn't doing something sufficiently, we should move the convo there. |
@shvaikalesh ah, that makes sense! |
Based on the discussion, it looks like we just need to switch the |
Hey @shvaikalesh. @lucasfcosta and I are clearing house on all these PRs. We have https://github.com/chaijs/chai/projects/2 which we're going to use to track some features we want, but we're going to significantly refactor all of chai over the next few weeks. We'll be sure to come back to this. I'll drop you some messages when |
Supersedes #829. We still need to do some work with
inspect
(according to extremely useful #457 👍 ) though: it seems we can use Node'sutil.inspect
for every type expect forHTMLElement
. Is anyone working onloupe
orinspect
atm or I can help?