@github/details-menu-element
Advanced tools
Comparing version 0.7.0 to 0.8.0
@@ -53,2 +53,9 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
details.addEventListener('toggle', closeCurrentMenu); | ||
if (this.preload) { | ||
details.addEventListener('mouseover', loadFragment, { | ||
once: true | ||
}); | ||
} | ||
var subscriptions = [focusOnOpen(details)]; | ||
@@ -99,4 +106,19 @@ states.set(this, { | ||
details.removeEventListener('toggle', closeCurrentMenu); | ||
details.removeEventListener('mouseover', loadFragment, { | ||
once: true | ||
}); | ||
} | ||
}, { | ||
key: "preload", | ||
get: function get() { | ||
return this.hasAttribute('preload'); | ||
}, | ||
set: function set(value) { | ||
if (value) { | ||
this.setAttribute('preload', ''); | ||
} else { | ||
this.removeAttribute('preload'); | ||
} | ||
} | ||
}, { | ||
key: "src", | ||
@@ -125,3 +147,3 @@ get: function get() { | ||
if (loader) { | ||
if (loader && !loader.hasAttribute('src')) { | ||
loader.addEventListener('loadend', function () { | ||
@@ -128,0 +150,0 @@ return autofocus(details); |
@@ -73,2 +73,9 @@ (function (global, factory) { | ||
details.addEventListener('toggle', closeCurrentMenu); | ||
if (this.preload) { | ||
details.addEventListener('mouseover', loadFragment, { | ||
once: true | ||
}); | ||
} | ||
var subscriptions = [focusOnOpen(details)]; | ||
@@ -119,4 +126,19 @@ states.set(this, { | ||
details.removeEventListener('toggle', closeCurrentMenu); | ||
details.removeEventListener('mouseover', loadFragment, { | ||
once: true | ||
}); | ||
} | ||
}, { | ||
key: "preload", | ||
get: function get() { | ||
return this.hasAttribute('preload'); | ||
}, | ||
set: function set(value) { | ||
if (value) { | ||
this.setAttribute('preload', ''); | ||
} else { | ||
this.removeAttribute('preload'); | ||
} | ||
} | ||
}, { | ||
key: "src", | ||
@@ -145,3 +167,3 @@ get: function get() { | ||
if (loader) { | ||
if (loader && !loader.hasAttribute('src')) { | ||
loader.addEventListener('loadend', function () { | ||
@@ -148,0 +170,0 @@ return autofocus(details); |
{ | ||
"name": "@github/details-menu-element", | ||
"version": "0.7.0", | ||
"version": "0.8.0", | ||
"description": "A menu opened with a <details> button.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.umd.js", |
@@ -81,3 +81,3 @@ # <details-menu> element | ||
<summary>Robots</summary> | ||
<details-menu src="/robots"> | ||
<details-menu src="/robots" preload> | ||
<include-fragment>Loading…</include-fragment> | ||
@@ -91,2 +91,6 @@ </details-menu> | ||
If the `preload` attribute is present, the server fetch will begin on mouse | ||
hover over the `<details>` button, so the content may be loaded by the time | ||
the menu is opened. | ||
## Browser support | ||
@@ -93,0 +97,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
34460
728
117