reverted: --- b/core-js-offset-mess-1870006-10.patch +++ /dev/null @@ -1,84 +0,0 @@ -diff --git a/core/misc/offset/fragment.js b/core/misc/offset/fragment.js -new file mode 100644 -index 0000000..b2aac4f ---- /dev/null -+++ b/core/misc/offset/fragment.js -@@ -0,0 +1,26 @@ -+/** -+ * @file -+ * Offsets the window to allow fragments navigation with fixed positioning elements. -+ */ -+(function ($, Drupal, displace) { -+ -+ "use strict"; -+ -+ function adjustOffset () { -+ var hash = window.location.hash; -+ if (hash) { -+ var element = document.getElementById(hash.replace('#', '')); -+ if (element) { -+ // Display the element in the viewport. -+ setTimeout(function () { -+ window.scrollTo(0, $(element).offset().top - displace.offsets.top); -+ }, 5); -+ } -+ } -+ } -+ -+ // Checks for a fragment on page load, outside Drupal behaviors. -+ Drupal.behaviors.adjustOffset = { attach: adjustOffset }; -+ $(window).on('hashchange', adjustOffset); -+ -+})(jQuery, Drupal, Drupal.displace); -diff --git a/core/misc/offset/html5forms.js b/core/misc/offset/html5forms.js -new file mode 100644 -index 0000000..32e0d33 ---- /dev/null -+++ b/core/misc/offset/html5forms.js -@@ -0,0 +1,13 @@ -+/** -+ * @file -+ * Focus the HTML5 validation error in view. -+ */ -+(function (displace) { -+ -+ "use strict"; -+ -+ document.addEventListener('invalid', function (event) { -+ setTimeout(function () { window.scrollBy(0, -displace.offsets.top); }, 5); -+ }, true); -+ -+})(Drupal.displace); -diff --git a/core/modules/system/system.module b/core/modules/system/system.module -index 10bc48d..364e848 100644 ---- a/core/modules/system/system.module -+++ b/core/modules/system/system.module -@@ -952,6 +952,10 @@ function system_library_info() { - 'version' => Drupal::VERSION, - 'js' => array( - 'core/misc/drupal.js' => array('group' => JS_LIBRARY, 'weight' => -18), -+ 'core/misc/debounce.js' => array('group' => JS_LIBRARY), -+ 'core/misc/displace.js' => array('group' => JS_LIBRARY), -+ 'core/misc/offset/fragment.js' => array('group' => JS_LIBRARY), -+ 'core/misc/offset/html5forms.js' => array('group' => JS_LIBRARY), - ), - 'dependencies' => array( - array('system', 'domready'), -@@ -1162,7 +1166,7 @@ function system_library_info() { - 'title' => 'Drupal displace', - 'version' => Drupal::VERSION, - 'js' => array( -- 'core/misc/displace.js' => array('group' => JS_LIBRARY), -+ //'core/misc/displace.js' => array('group' => JS_LIBRARY), - ), - 'dependencies' => array( - array('system', 'jquery'), -@@ -1191,7 +1195,7 @@ function system_library_info() { - 'title' => 'Drupal debounce', - 'version' => Drupal::VERSION, - 'js' => array( -- 'core/misc/debounce.js' => array('group' => JS_LIBRARY), -+ //'core/misc/debounce.js' => array('group' => JS_LIBRARY), - ), - 'dependencies' => array( - // @todo remove drupal dependency. diff -u b/core/misc/offset/fragment.js b/core/misc/offset/fragment.js --- b/core/misc/offset/fragment.js +++ b/core/misc/offset/fragment.js @@ -1,17 +1,19 @@ /** - * @file - * Offsets the window to allow fragments navigation with fixed positioning elements. - */ +* DO NOT EDIT THIS FILE. +* See the following change record for more information, +* https://www.drupal.org/node/2815083 +* @preserve +**/ + (function ($, Drupal, displace) { "use strict"; - function adjustOffset () { + function adjustOffset() { var hash = window.location.hash; if (hash) { var element = document.getElementById(hash.replace('#', '')); if (element) { - // Display the element in the viewport. setTimeout(function () { window.scrollTo(0, $(element).offset().top - displace.offsets.top); }, 5); @@ -21,6 +23,4 @@ - // Checks for a fragment on page load, outside Drupal behaviors. Drupal.behaviors.adjustOffset = { attach: adjustOffset }; $(window).on('hashchange', adjustOffset); - })(jQuery, Drupal, Drupal.displace); \ No newline at end of file diff -u b/core/misc/offset/html5forms.js b/core/misc/offset/html5forms.js --- b/core/misc/offset/html5forms.js +++ b/core/misc/offset/html5forms.js @@ -1,13 +1,17 @@ /** - * @file - * Focus the HTML5 validation error in view. - */ +* DO NOT EDIT THIS FILE. +* See the following change record for more information, +* https://www.drupal.org/node/2815083 +* @preserve +**/ + (function (displace) { "use strict"; document.addEventListener('invalid', function (event) { - setTimeout(function () { window.scrollBy(0, -displace.offsets.top); }, 5); + setTimeout(function () { + window.scrollBy(0, -displace.offsets.top); + }, 5); }, true); - })(Drupal.displace); \ No newline at end of file only in patch2: unchanged: --- a/core/core.libraries.yml +++ b/core/core.libraries.yml @@ -215,10 +215,13 @@ drupal.form: version: VERSION js: misc/form.js: {} + misc/offset/fragment.js: {} + misc/offset/html5forms.js: {} dependencies: - core/jquery - core/drupal - core/drupal.debounce + - core/drupal.displace - core/jquery.cookie - core/jquery.once only in patch2: unchanged: --- /dev/null +++ b/core/misc/offset/fragment.es6.js @@ -0,0 +1,26 @@ +/** + * @file + * Offsets the window to allow fragments navigation with fixed positioning elements. + */ +(function ($, Drupal, displace) { + + "use strict"; + + function adjustOffset () { + var hash = window.location.hash; + if (hash) { + var element = document.getElementById(hash.replace('#', '')); + if (element) { + // Display the element in the viewport. + setTimeout(function () { + window.scrollTo(0, $(element).offset().top - displace.offsets.top); + }, 5); + } + } + } + + // Checks for a fragment on page load, outside Drupal behaviors. + Drupal.behaviors.adjustOffset = { attach: adjustOffset }; + $(window).on('hashchange', adjustOffset); + +})(jQuery, Drupal, Drupal.displace); only in patch2: unchanged: --- /dev/null +++ b/core/misc/offset/html5forms.es6.js @@ -0,0 +1,13 @@ +/** + * @file + * Focus the HTML5 validation error in view. + */ +(function (displace) { + + "use strict"; + + document.addEventListener('invalid', function (event) { + setTimeout(function () { window.scrollBy(0, -displace.offsets.top); }, 5); + }, true); + +})(Drupal.displace);