Skip to content

Commit

Permalink
Made it so testProp(prop, value) and testAllProps(prop, value) wi…
Browse files Browse the repository at this point in the history
…ll use a manual set-and-check to verify that the provided value is valid for the named property
  • Loading branch information
stucox committed Feb 26, 2013
1 parent 0cc5d3d commit 1ca3a01
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions src/testProps.js
@@ -1,4 +1,4 @@
define(['contains', 'mStyle', 'createElement', 'nativeTestProps', 'is'], function( contains, mStyle, createElement, nativeTestProps, is ) {
define(['contains', 'mStyle', 'createElement', 'nativeTestProps', 'is', 'injectElementWithStyles', 'getComputedStyle'], function( contains, mStyle, createElement, nativeTestProps, is, injectElementWithStyles, getComputedStyle ) {
// testProps is a generic CSS / DOM property test.

// In testing support for a given CSS property, it's legit to test:
Expand All @@ -23,9 +23,12 @@ define(['contains', 'mStyle', 'createElement', 'nativeTestProps', 'is'], functio
if (!is(values, 'undefined')) {
var result = nativeTestProps(props, values);
if(!is(result, 'undefined')) {
console.log('native');
return result;
}
}

// Otherwise do it properly
var afterInit;

// If we don't have a style element, that means
Expand All @@ -45,12 +48,27 @@ define(['contains', 'mStyle', 'createElement', 'nativeTestProps', 'is'], functio
delete mStyle.modElem;
}
}

console.log('manual');
for ( var i in props ) {
var prop = props[i];
if ( !contains(prop, "-") && mStyle.style[prop] !== undefined ) {
cleanElems();
return prefixed == 'pfx' ? prop : true;

// If values to test have been passed in, do a set-and-check test
if (!is(values, 'undefined')) {
var j = values.length;
while (j--) {
var value = values[j];
mStyle.style[prop] = value;
if (mStyle.style[prop] == value) {
cleanElems();
return prefixed == 'pfx' ? prop : true;
}
}
}
else {
cleanElems();
return prefixed == 'pfx' ? prop : true;
}
}
}
cleanElems();
Expand Down

0 comments on commit 1ca3a01

Please sign in to comment.