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

nodeType for element #8

Merged
merged 3 commits into from
May 13, 2015
Merged

nodeType for element #8

merged 3 commits into from
May 13, 2015

Conversation

cruzanmo
Copy link

@cruzanmo cruzanmo commented May 1, 2015

No description provided.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 98.7% when pulling 10b9f30 on node-type into eb93beb on master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 98.7% when pulling ab56ff4 on node-type into eb93beb on master.

@@ -55,7 +55,7 @@ var Module = (function () {
* @returns {boolean}
*/
function isElement(obj) {
return typeof obj === 'object' && typeof obj.nodeName === 'string';
return (obj && obj.nodeType === 1) === true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why === true? Code is expensive on the client-side. If you really need a boolean, !! is only two characters compared to your === true nine characters.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 98.7% when pulling 53e03b1 on node-type into eb93beb on master.

@TakenPilot
Copy link
Contributor

+1

cruzanmo pushed a commit that referenced this pull request May 13, 2015
@cruzanmo cruzanmo merged commit b1f1c0d into master May 13, 2015
@cruzanmo cruzanmo deleted the node-type branch May 13, 2015 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants