Skip to content

Commit ad48721

Browse files
committed
Make resize triggers use default CSS writing mode
The Chromium community is moving to scroll position values indicated in the CSSOM specification [1]. In order to launch the feature and analyze potential broken URLs, they count pages setting the scroll position of a scroller in non-default writing mode to a positive value. Websites using javascript-detect-element-resize in RTL or vertical mode appear in the top results and cause a lot of false positives [2]. In order to avoid that, ensure that the resize triggers use the default writing mode (direction: ltr and writing-mode: horizontal-tb). [1] https://www.chromestatus.com/feature/5759578031521792 [2] sdecima#61
1 parent 1b79a1a commit ad48721

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

detect-element-resize.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
if (!stylesCreated) {
9393
//opacity:0 works around a chrome bug https://code.google.com/p/chromium/issues/detail?id=286360
9494
var css = (animationKeyframes ? animationKeyframes : '') +
95-
'.resize-triggers { ' + (animationStyle ? animationStyle : '') + 'visibility: hidden; opacity: 0; } ' +
95+
'.resize-triggers { ' + (animationStyle ? animationStyle : '') + 'visibility: hidden; opacity: 0; direction: ltr; writing-mode: horizontal-tb; } ' +
9696
'.resize-triggers, .resize-triggers > div, .contract-trigger:before { content: \" \"; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }',
9797
head = document.head || document.getElementsByTagName('head')[0],
9898
style = document.createElement('style');

jquery.resize.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
//opacity:0 works around a chrome bug https://code.google.com/p/chromium/issues/detail?id=286360
111111
var css = (animationKeyframes ? animationKeyframes : '') +
112112
'.resize-triggers { ' + (animationStyle ? animationStyle : '') + 'visibility: hidden; opacity: 0; } ' +
113-
'.resize-triggers, .resize-triggers > div, .contract-trigger:before { content: \" \"; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }',
113+
'.resize-triggers, .resize-triggers > div, .contract-trigger:before { content: \" \"; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; direction: ltr; writing-mode: horizontal-tb; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }',
114114
head = document.head || document.getElementsByTagName('head')[0],
115115
style = document.createElement('style');
116116

0 commit comments

Comments
 (0)