Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions HTMLCS.js
Original file line number Diff line number Diff line change
Expand Up @@ -671,14 +671,15 @@ var HTMLCS = new function()
*
* @returns {Object}
*/
this.style = function(element) {
this.style = function(element, pseudo) {
var computedStyle = null;
var window = this.getElementWindow(element);
var pseudo = pseudo || null;

if (element.currentStyle) {
computedStyle = element.currentStyle;
} else if (window.getComputedStyle) {
computedStyle = window.getComputedStyle(element, null);
computedStyle = window.getComputedStyle(element, pseudo);
}

return computedStyle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,23 @@ var HTMLCS_WCAG2AAA_Sniffs_Principle1_Guideline1_4_1_4_3_Contrast = {
if (parentStyle.position == 'absolute') {
isAbsolute = true;
}

//Search for the smooth scrolling willChange: 'transform' background hack
//See http://fourkitchens.com/blog/article/fix-scrolling-performance-css-will-change-property
var beforeStyle = HTMLCS.util.style(parent, ':before');
if (
beforeStyle
&& beforeStyle.position == 'fixed'
&& beforeStyle.willChange == 'transform'
//Make sure it is trying to cover the entire content area
&& beforeStyle.width == parentStyle.width
&& parseInt(beforeStyle.height, 10) <= parseInt(parentStyle.height, 10)
//And finally it needs a background image
&& beforeStyle.backgroundImage !== 'none'
) {
hasBgImg = true;
break;
}

parent = parent.parentNode;
}//end while
Expand Down