diff --git a/feature-detects/dom/shadowroot.js b/feature-detects/dom/shadowroot.js new file mode 100644 index 0000000000..ca2354b020 --- /dev/null +++ b/feature-detects/dom/shadowroot.js @@ -0,0 +1,20 @@ +/*! +{ + "name": "Shadow DOM API", + "property": "shadowroot", + "caniuse": "shadowdomv1", + "notes": [{ + "name": "MDN Docs", + "href": "https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot" + }], + "authors": ["Kevin Coyle (@kevin-coyle-unipro)", "Pascal Lim (@pascalim)"], + "tags": ["dom"] +} +!*/ + +/* DOC +Detects support for the Shadow DOM API. +*/ +define(['Modernizr', 'createElement'], function (Modernizr, createElement) { + Modernizr.addTest('shadowroot', 'attachShadow' in createElement('div')); +}); diff --git a/feature-detects/dom/shadowrootlegacy.js b/feature-detects/dom/shadowrootlegacy.js new file mode 100644 index 0000000000..9ad65b5773 --- /dev/null +++ b/feature-detects/dom/shadowrootlegacy.js @@ -0,0 +1,20 @@ +/*! +{ + "name": "Shadow DOM API (Legacy)", + "property": "shadowrootlegacy", + "caniuse": "shadowdom", + "notes": [{ + "name": "MDN Docs", + "href": "https://developer.mozilla.org/en-US/docs/Web/API/Element/createShadowRoot" + }], + "authors": ["Kevin Coyle (@kevin-coyle-unipro)", "Pascal Lim (@pascalim)"], + "tags": ["dom"] +} +!*/ + +/* DOC +Detects support for the Shadow DOM API. (Legacy) +*/ +define(['Modernizr', 'createElement'], function (Modernizr, createElement) { + Modernizr.addTest('shadowrootlegacy', 'createShadowRoot' in createElement('div')); +}); diff --git a/lib/config-all.json b/lib/config-all.json index 97c5e4f2ab..5b44512eb9 100644 --- a/lib/config-all.json +++ b/lib/config-all.json @@ -142,6 +142,8 @@ "dom/microdata", "dom/mutationObserver", "dom/passiveeventlisteners", + "dom/shadowroot", + "dom/shadowrootlegacy", "elem/bdi", "elem/datalist", "elem/details",