diff --git a/package.json b/package.json index a3752633..34a4da0d 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,6 @@ "react": "17.0.2", "react-dom": "17.0.2", "react-id-swiper": "2.3.2", - "style-scoped": "0.2.2", "swiper": "4.5.1" }, "devDependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b2a88bd5..97afbc69 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -41,9 +41,6 @@ importers: react-id-swiper: specifier: 2.3.2 version: 2.3.2(react-dom@17.0.2(react@17.0.2))(react@17.0.2)(swiper@4.5.1) - style-scoped: - specifier: 0.2.2 - version: 0.2.2 swiper: specifier: 4.5.1 version: 4.5.1 @@ -2320,9 +2317,6 @@ packages: resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} engines: {node: '>=8'} - style-scoped@0.2.2: - resolution: {integrity: sha512-KOVGTDx6XhrHncmgBQrZBICZVNEfCH+pCO2z1pH9602Vd0zUJ+qONuX0qBba4jS//H1H8lKCc/lxfGG31wlTuQ==} - supports-color@7.2.0: resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} engines: {node: '>=8'} @@ -4902,8 +4896,6 @@ snapshots: strip-json-comments@3.1.1: {} - style-scoped@0.2.2: {} - supports-color@7.2.0: dependencies: has-flag: 4.0.0 diff --git a/src/bloom-player-core.tsx b/src/bloom-player-core.tsx index adca28ee..69a555a2 100644 --- a/src/bloom-player-core.tsx +++ b/src/bloom-player-core.tsx @@ -5,8 +5,9 @@ bloom-player-core is responsible for all the behavior of working through a book, import * as React from "react"; import axios from "axios"; import Swiper, { SwiperInstance } from "react-id-swiper"; -// This loads some JS right here that is a polyfill for the (otherwise discontinued) scoped-styles html feature -import "style-scoped/scoped.min.js"; +// This loads some JS right here that is a polyfill for the (otherwise discontinued) scoped-styles html feature. +// We use a patched version that fixes a bug with comma-separated selectors containing attribute selectors. +import "./scoped-styles-polyfill.js"; import "swiper/dist/css/swiper.min.css"; import "./bloom-player-ui.less"; import "./bloom-player-content.less"; diff --git a/src/scoped-styles-polyfill.js b/src/scoped-styles-polyfill.js new file mode 100644 index 00000000..c8ae7874 --- /dev/null +++ b/src/scoped-styles-polyfill.js @@ -0,0 +1,451 @@ +/* + * Copyright 2017 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +/** + * @fileoverview Polyfill for `