Commit 1b3b95a6 authored by Samuel Mortenson's avatar Samuel Mortenson Committed by Sam Mortenson
Browse files

Issue #3289578 by samuel.mortenson, Project Update Bot: Automated Drupal 10 compatibility fixes

parent 65814d02
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -151,8 +151,8 @@ Any and all combinations of defining libraries and CSS/JS should work.

In Drupal, JavaScript that binds behavior to elements is supposed to do so
inside a behavior attachment, using the context passed to it, and is then even
expected to use the jQuery.once plugin to prevent common problems like double
binding event handlers.
expected to use the once plugin to prevent common problems like double binding
event handlers.

This can become quite monotonous, so as an alternative to using `<script>` to
define global JS, you can instead provide `<script data-type"attach">` and
@@ -201,8 +201,8 @@ as well as `data-sfc-unique-id`, which is a string that is unique to this
render of the component.

Drupal Core has recently started moving away from jQuery, so if you'd like to
use vanilla JS with your attachments (wrapping them in "once()" instead of
"jQuery.once()") you can add the "data-vanilla" attribute to your script tag.
use vanilla JS with your attachments you can add the "data-vanilla" attribute
to your script tag.
Note that when using vanilla JS, "element" refers to your current element, not
"this". For example:

+1 −1
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@
   */
  Drupal.behaviors.sfcDevPollChanges = {
    attach: function (context, settings) {
      $(window).once('sfc-dev-poll-changes').each(function () {
      $(once('sfc-dev-poll-changes', 'body')).each(function () {
        setInterval(function () {
          var $checkbox = $('.js-component-auto-preview');
          if (!$checkbox.length) {
+1 −2
Original line number Diff line number Diff line
name: Single File Components Development Tools
type: module
description: Contains useful development tools for SFC. Do not enable in production.
core: 8.x
core_version_requirement: ^8 || ^9 || ^10
core_version_requirement: ^9 || ^10
dependencies:
- sfc:sfc
+1 −1
Original line number Diff line number Diff line
@@ -4,4 +4,4 @@ main:
    js/sfc_dev.js: {}
  dependencies:
  - core/drupal.ajax
  - core/jquery.once
  - core/once
+1 −1
Original line number Diff line number Diff line
@@ -262,7 +262,7 @@ JS;
      $plugin_id,
      $plugin_definition,
      static::getDebugParameter($container),
      $container->get('app.root'),
      $container->getParameter('app.root'),
      $container->get('file_system'),
      $container->get('form_builder')
    );
Loading