Skip to content

Commit

Permalink
Switch to modern webcomponents polyfill + workaround issue with it
Browse files Browse the repository at this point in the history
  • Loading branch information
cdrini committed Oct 4, 2021
1 parent f204f8d commit 88759ee
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 220 deletions.
2 changes: 1 addition & 1 deletion BookReaderDemo/demo-internetarchive.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<meta name="apple-mobile-web-app-capable" content="yes">

<!-- JS dependencies -->
<script src="https://unpkg.com/@webcomponents/custom-elements"></script>
<script src="https://unpkg.com/@webcomponents/webcomponentsjs@2.6.0/webcomponents-bundle.js"></script>
<script src="../BookReader/jquery-1.10.1.js"></script>


Expand Down
1 change: 0 additions & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,5 @@ module.exports = {
["@babel/plugin-proposal-class-properties", {loose: true}],
["@babel/plugin-proposal-private-property-in-object", { loose: true }],
["@babel/plugin-proposal-private-methods", { loose: true }],
"transform-custom-element-classes",
]
};
215 changes: 0 additions & 215 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
"@open-wc/testing-karma": "^4.0.9",
"@types/jest": "27.0.1",
"babel-loader": "8.2.2",
"babel-plugin-transform-custom-element-classes": "^0.1.0",
"codecov": "3.8.3",
"concurrently": "6.0.2",
"core-js": "3.16.2",
Expand Down
6 changes: 5 additions & 1 deletion src/BookReader/Mode1Up.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ export class Mode1Up {
this.mode1UpLit = new Mode1UpLit(bookModel, br);

/** @private */
this.$el = $(this.mode1UpLit).addClass('br-mode-1up BRmode1up');
this.$el = $(this.mode1UpLit)
// We CANNOT use `br-mode-1up` as a class, because it's the same
// as the name of the web component, and the webcomponents polyfill
// uses the name of component as a class for style scoping 😒
.addClass('br-mode-1up__root BRmode1up');

/** Has mode1up ever been rendered before? */
this.everShown = false;
Expand Down
2 changes: 1 addition & 1 deletion src/css/_BRpages.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
cursor: unset;
}

.br-mode-1up {
.br-mode-1up__root {
display: block;
overflow: auto;
position: relative;
Expand Down

0 comments on commit 88759ee

Please sign in to comment.