From 0a6ea4c38a05894b7e14f02e8864848a5d012cd0 Mon Sep 17 00:00:00 2001 From: Brandon Payton Date: Fri, 1 Jun 2018 14:00:03 -0700 Subject: [PATCH] Add Node#contains polyfill --- lib/client-assets.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/client-assets.php b/lib/client-assets.php index 6df0fa29f57049..cbba166b2c3a31 100644 --- a/lib/client-assets.php +++ b/lib/client-assets.php @@ -150,6 +150,13 @@ function gutenberg_register_scripts_and_styles() { filemtime( gutenberg_dir_path() . 'build/dom/index.js' ), true ); + wp_add_inline_script( + 'wp-dom', + gutenberg_get_script_polyfill( array( + 'document.contains' => 'node-contains', + ) ), + 'before' + ); wp_register_script( 'wp-utils', gutenberg_url( 'build/utils/index.js' ), @@ -560,6 +567,10 @@ function gutenberg_register_vendor_scripts() { 'formdata', 'https://unpkg.com/formdata-polyfill@3.0.9/formdata.min.js' ); + gutenberg_register_vendor_script( + 'node-contains', + 'https://unpkg.com/polyfill-library@3.26.0-0/polyfills/Node/prototype/contains/polyfill.js' + ); } /**