mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Merge pull request #11569 from Snuffleupagus/rm-most-setAttribute
Replace most remaining `Element.setAttribute("style", ...)` usage with `Element.style = ...` instead
This commit is contained in:
commit
a73a38029c
6 changed files with 14 additions and 26 deletions
|
@ -67,7 +67,6 @@ var FontInspector = (function FontInspectorClosure() {
|
|||
manager: null,
|
||||
init: function init(pdfjsLib) {
|
||||
var panel = this.panel;
|
||||
panel.setAttribute("style", "padding: 5px;");
|
||||
var tmp = document.createElement("button");
|
||||
tmp.addEventListener("click", resetSelection);
|
||||
tmp.textContent = "Refresh";
|
||||
|
@ -178,7 +177,6 @@ var StepperManager = (function StepperManagerClosure() {
|
|||
manager: null,
|
||||
init: function init(pdfjsLib) {
|
||||
var self = this;
|
||||
this.panel.setAttribute("style", "padding: 5px;");
|
||||
stepperControls = document.createElement("div");
|
||||
stepperChooser = document.createElement("select");
|
||||
stepperChooser.addEventListener("change", function(event) {
|
||||
|
@ -468,9 +466,7 @@ var Stats = (function Stats() {
|
|||
name: "Stats",
|
||||
panel: null,
|
||||
manager: null,
|
||||
init(pdfjsLib) {
|
||||
this.panel.setAttribute("style", "padding: 5px;");
|
||||
},
|
||||
init(pdfjsLib) {},
|
||||
enabled: false,
|
||||
active: false,
|
||||
// Stats specific functions.
|
||||
|
|
|
@ -94,16 +94,11 @@ class PDFOutlineViewer {
|
|||
* @private
|
||||
*/
|
||||
_setStyles(element, { bold, italic }) {
|
||||
let styleStr = "";
|
||||
if (bold) {
|
||||
styleStr += "font-weight: bold;";
|
||||
element.style.fontWeight = "bold";
|
||||
}
|
||||
if (italic) {
|
||||
styleStr += "font-style: italic;";
|
||||
}
|
||||
|
||||
if (styleStr) {
|
||||
element.setAttribute("style", styleStr);
|
||||
element.style.fontStyle = "italic";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -340,10 +340,8 @@ class SecondaryToolbar {
|
|||
if (this.containerHeight === this.previousContainerHeight) {
|
||||
return;
|
||||
}
|
||||
this.toolbarButtonContainer.setAttribute(
|
||||
"style",
|
||||
"max-height: " + (this.containerHeight - SCROLLBAR_PADDING) + "px;"
|
||||
);
|
||||
this.toolbarButtonContainer.style.maxHeight = `${this.containerHeight -
|
||||
SCROLLBAR_PADDING}px`;
|
||||
|
||||
this.previousContainerHeight = this.containerHeight;
|
||||
}
|
||||
|
|
|
@ -890,10 +890,7 @@ class ProgressBar {
|
|||
const container = viewer.parentNode;
|
||||
const scrollbarWidth = container.offsetWidth - viewer.offsetWidth;
|
||||
if (scrollbarWidth > 0) {
|
||||
this.bar.setAttribute(
|
||||
"style",
|
||||
"width: calc(100% - " + scrollbarWidth + "px);"
|
||||
);
|
||||
this.bar.style.width = `calc(100% - ${scrollbarWidth}px)`;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1479,6 +1479,9 @@ html[dir='rtl'] #documentPropertiesOverlay .row > * {
|
|||
right: 0;
|
||||
top: 27px;
|
||||
}
|
||||
#PDFBug .panels > div {
|
||||
padding: 5px;
|
||||
}
|
||||
#PDFBug button.active {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue