Comparing version 1.5.1 to 2.0.0
@@ -29,2 +29,3 @@ 'use strict'; | ||
var slice = Array.prototype.slice; | ||
var nameOverridesBuiltin = require('./name-overrides-builtin'); | ||
@@ -813,2 +814,14 @@ | ||
/** | ||
* Does the given name potentially override a builtin property of `document` or `HTMLFormElement`? | ||
* This list of invalid properties used by this method might not be exhaustive, this method is not intended | ||
* to validate arbitrary user input. | ||
* @param name Value of `name` or `id` attribute | ||
* @return {Boolean} True if this name overrides a builtin property | ||
*/ | ||
module.exports.nameOverridesBuiltin = function(name) | ||
{ | ||
return nameOverridesBuiltin(name); | ||
}; | ||
/** | ||
* <p>The Node interface is the primary datatype for the entire Document Object Model. | ||
@@ -815,0 +828,0 @@ * It represents a single node in the document tree. While all objects implementing |
{ | ||
"name": "domv", | ||
"version": "1.5.1", | ||
"version": "2.0.0", | ||
"author": "Joris van der Wel <joris@jorisvanderwel.com>", | ||
@@ -39,14 +39,14 @@ "description": "Create views as components using DOM. Run the same code on the browser and on the server.", | ||
"inherits": "^2.0.1", | ||
"throwable": "^1.0.0" | ||
"throwable": "^1.0.3" | ||
}, | ||
"optionalDependencies": { | ||
"jsdom": "^3.1.0" | ||
"jsdom": "^5.4.3" | ||
}, | ||
"devDependencies": { | ||
"browserify": "^7.0.1", | ||
"istanbul": "^0.3.5", | ||
"jsdoc": "^3.3.0-alpha11", | ||
"jsdoc-to-markdown": "^0.6.4", | ||
"jshint": "^2.5.10", | ||
"nodeunit": "^0.9.0" | ||
"browserify": "^10.2.1", | ||
"istanbul": "^0.3.14", | ||
"jsdoc": "^3.3.0", | ||
"jsdoc-to-markdown": "^1.1.1", | ||
"jshint": "^2.7.0", | ||
"nodeunit": "^0.9.1" | ||
}, | ||
@@ -53,0 +53,0 @@ "scripts": { |
@@ -5,2 +5,24 @@ 'use strict'; | ||
function getAllPropertyNames() | ||
{ | ||
var names = []; | ||
for (var i = 0; i < arguments.length; ++i) | ||
{ | ||
var obj = arguments[i]; | ||
while (obj) | ||
{ | ||
names = names.concat(Object.getOwnPropertyNames(obj)); | ||
obj = Object.getPrototypeOf(obj); | ||
} | ||
} | ||
names.sort(); | ||
return names.filter(function(name, index, names) | ||
{ | ||
return index === 0 || names[index - 1] !== name; | ||
}); | ||
} | ||
function testParseHTMLDocumentResult(test, doc) | ||
@@ -488,3 +510,37 @@ { | ||
test.done(); | ||
}, | ||
'nameOverridesBuiltin': function(test) | ||
{ | ||
getAllPropertyNames(this.document).forEach(function(name) | ||
{ | ||
if (require('jsdom').jsdom && name[0] === '_') | ||
{ | ||
// skip jsdom interal property | ||
// (also, jsdom does not support [OverrideBuiltins] yet) | ||
return; | ||
} | ||
test.ok(domv.nameOverridesBuiltin(name), name); | ||
}); | ||
getAllPropertyNames(this.document.createElement('form')).forEach(function(name) | ||
{ | ||
if (require('jsdom').jsdom && name[0] === '_') | ||
{ | ||
// skip jsdom interal property | ||
// (also, jsdom does not support [OverrideBuiltins] yet) | ||
return; | ||
} | ||
test.ok(domv.nameOverridesBuiltin(name), name); | ||
}); | ||
// a few random ones it should return false for | ||
test.ok(!domv.nameOverridesBuiltin('foo')); | ||
test.ok(!domv.nameOverridesBuiltin('firstchild')); // (wrong case) | ||
test.ok(!domv.nameOverridesBuiltin('bar')); | ||
test.ok(!domv.nameOverridesBuiltin('')); | ||
test.done(); | ||
} | ||
}; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
413483
19
5964
+ Addedacorn@1.2.2(transitive)
+ Addedjsdom@5.6.1(transitive)
+ Addedsetimmediate@1.0.5(transitive)
+ Addedtough-cookie@1.2.0(transitive)
+ Addedxml-name-validator@2.0.1(transitive)
+ Addedxtend@4.0.2(transitive)
- Removedacorn@0.11.0(transitive)
- Removedbindings@1.5.0(transitive)
- Removedcontextify@0.1.15(transitive)
- Removedfile-uri-to-path@1.0.0(transitive)
- Removedjsdom@3.1.2(transitive)
- Removednan@2.20.0(transitive)
- Removedxml-name-validator@1.0.0(transitive)
Updatedthrowable@^1.0.3