Browse Source

removed unused code

Gildas 7 năm trước cách đây
mục cha
commit
27e8eafb60
1 tập tin đã thay đổi với 11 bổ sung13 xóa
  1. 11 13
      lib/single-file/util/doc-helper.js

+ 11 - 13
lib/single-file/util/doc-helper.js

@@ -305,27 +305,25 @@ this.docHelper = this.docHelper || (() => {
 
 	function getSize(win, imageElement) {
 		const computedStyle = win.getComputedStyle(imageElement);
-		let boxSizingEffective = false;
-		const boxSizingValue = imageElement.style.getPropertyValue("box-sizing");
-		const boxSizingPriority = imageElement.style.getPropertyPriority("box-sizing");
-		const clientWidth = imageElement.clientWidth;
+		let removeBorderWidth = false;
 		if (computedStyle.getPropertyValue("box-sizing") == "content-box") {
+			const boxSizingValue = imageElement.style.getPropertyValue("box-sizing");
+			const boxSizingPriority = imageElement.style.getPropertyPriority("box-sizing");
+			const clientWidth = imageElement.clientWidth;
 			imageElement.style.setProperty("box-sizing", "border-box", "important");
-		} else {
-			imageElement.style.setProperty("box-sizing", "content-box", "important");
-		}
-		boxSizingEffective = imageElement.clientWidth != clientWidth;
-		if (boxSizingValue) {
-			imageElement.style.setProperty("box-sizing", boxSizingValue, boxSizingPriority);
-		} else {
-			imageElement.style.removeProperty("box-sizing");
+			removeBorderWidth = imageElement.clientWidth != clientWidth;
+			if (boxSizingValue) {
+				imageElement.style.setProperty("box-sizing", boxSizingValue, boxSizingPriority);
+			} else {
+				imageElement.style.removeProperty("box-sizing");
+			}
 		}
 		let paddingLeft, paddingRight, paddingTop, paddingBottom, borderLeft, borderRight, borderTop, borderBottom;
 		paddingLeft = getWidth("padding-left", computedStyle);
 		paddingRight = getWidth("padding-right", computedStyle);
 		paddingTop = getWidth("padding-top", computedStyle);
 		paddingBottom = getWidth("padding-bottom", computedStyle);
-		if (boxSizingEffective && computedStyle.getPropertyValue("box-sizing") == "content-box") {
+		if (removeBorderWidth) {
 			borderLeft = getWidth("border-left-width", computedStyle);
 			borderRight = getWidth("border-right-width", computedStyle);
 			borderTop = getWidth("border-top-width", computedStyle);