From 605196f3e64b60fe61bf446e1a6a64b3543e7f3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9lio=20Correia?= Date: Wed, 13 Oct 2021 20:40:12 +0100 Subject: [PATCH] Add a|area[ping] detection (#2671) * Add a|area[ping] detect * add aping|areaping to integration tests * Add author tag --- feature-detects/a/aping.js | 20 ++++++++++++++++++++ feature-detects/a/areaping.js | 20 ++++++++++++++++++++ lib/config-all.json | 2 ++ test/browser/integration/caniuse.js | 2 ++ 4 files changed, 44 insertions(+) create mode 100644 feature-detects/a/aping.js create mode 100644 feature-detects/a/areaping.js diff --git a/feature-detects/a/aping.js b/feature-detects/a/aping.js new file mode 100644 index 0000000000..70a887a3a0 --- /dev/null +++ b/feature-detects/a/aping.js @@ -0,0 +1,20 @@ +/*! +{ + "name": "a[ping] Attribute", + "property": "aping", + "caniuse": "ping", + "tags": ["media", "attribute"], + "builderAliases": ["a_ping"], + "authors": ["Hélio Correia (@heliocorreia)"], + "notes": [{ + "name": "WHATWG Spec", + "href": "https://html.spec.whatwg.org/dev/links.html#ping" + }] +} +!*/ +/* DOC +The ping attribute, if present, gives the URLs of the resources that are interested in being notified if the user follows the hyperlink. +*/ +define(['Modernizr', 'createElement'], function(Modernizr, createElement) { + Modernizr.addTest('aping', !window.externalHost && 'ping' in createElement('a')); +}); diff --git a/feature-detects/a/areaping.js b/feature-detects/a/areaping.js new file mode 100644 index 0000000000..1a84d5e0a2 --- /dev/null +++ b/feature-detects/a/areaping.js @@ -0,0 +1,20 @@ +/*! +{ + "name": "area[ping] Attribute", + "property": "areaping", + "caniuse": "ping", + "tags": ["media", "attribute"], + "builderAliases": ["area_ping"], + "authors": ["Hélio Correia (@heliocorreia)"], + "notes": [{ + "name": "WHATWG Spec", + "href": "https://html.spec.whatwg.org/dev/links.html#ping" + }] +} +!*/ +/* DOC +The ping attribute, if present, gives the URLs of the resources that are interested in being notified if the user follows the hyperlink. +*/ +define(['Modernizr', 'createElement'], function(Modernizr, createElement) { + Modernizr.addTest('areaping', !window.externalHost && 'ping' in createElement('area')); +}); diff --git a/lib/config-all.json b/lib/config-all.json index aecc71e4ee..f2e0c7fc3d 100644 --- a/lib/config-all.json +++ b/lib/config-all.json @@ -24,6 +24,8 @@ ], "feature-detects": [ "a/download", + "a/aping", + "a/areaping", "ambientlight", "applicationcache", "audio", diff --git a/test/browser/integration/caniuse.js b/test/browser/integration/caniuse.js index 5330dc386d..7a75c3e524 100644 --- a/test/browser/integration/caniuse.js +++ b/test/browser/integration/caniuse.js @@ -18,6 +18,8 @@ window.caniusecb = function(caniuse) { // the feature detect docs var map = { adownload: 'download', + aping: 'ping', + areaping: 'ping', ambientlight: 'ambient-light', apng: 'apng', appearance: 'css-appearance',