Skip to content

Commit

Permalink
Add in dom test metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
SlexAxton committed May 14, 2013
1 parent b9c780b commit df9a83a
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 8 deletions.
14 changes: 12 additions & 2 deletions feature-detects/dom/classlist.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
/*!
{
"name": "classList",
"caniuse": "classlist",
"property": "classlist",
"tags": ["dom"],
"notes": [{
"name": "MDN Docs",
"href": "https://developer.mozilla.org/en/DOM/element.classList"
}]
}
!*/
define(['Modernizr', 'docElement'], function( Modernizr, docElement ) {
// classList
// https://developer.mozilla.org/en/DOM/element.classList
Modernizr.addTest('classlist', 'classList' in docElement);
});
15 changes: 12 additions & 3 deletions feature-detects/dom/createElement-attrs.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
/*!
{
"name": "createElement with Attributes",
"property": ["createelementattrs", "createelement-attrs"],
"tags": ["dom"],
"authors": ["James A. Rosen"],
"notes": [{
"name": "Related Github Issue",
"href": "https://github.com/Modernizr/Modernizr/issues/258"
}]
}
!*/
define(['Modernizr', 'createElement'], function( Modernizr, createElement ) {
// by james a rosen.
// https://github.com/Modernizr/Modernizr/issues/258

Modernizr.addTest('createelementattrs', function() {
try {
return createElement('<input name="test" />').getAttribute('name') == 'test';
Expand Down
10 changes: 9 additions & 1 deletion feature-detects/dom/dataset.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
/*!
{
"name": "dataset API",
"caniuse": "dataset",
"property": "dataset",
"tags": ["dom"],
"authors": ["@phiggins42"]
}
!*/
define(['Modernizr', 'createElement'], function( Modernizr, createElement ) {
// dataset API for data-* attributes
// test by @phiggins42
Modernizr.addTest('dataset', function() {
var n = createElement("div");
n.setAttribute("data-a-b", "c");
Expand Down
13 changes: 11 additions & 2 deletions feature-detects/dom/microdata.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
/*!
{
"name": "microdata",
"property": "microdata",
"tags": ["dom"],
"notes": [{
"name": "W3 Spec",
"href": "http://www.w3.org/TR/html5/microdata.html"
}]
}
!*/
define(['Modernizr', 'createElement'], function( Modernizr, createElement ) {
// Microdata support
// http://www.w3.org/TR/html5/microdata.html
Modernizr.addTest('microdata', 'getItems' in document);
});

0 comments on commit df9a83a

Please sign in to comment.