Bug 1301305 - Move propertyToIDL to testcommon.js; r=hiro

We would like to use this method in the next patch.

MozReview-Commit-ID: CSdwlVInyds

--HG--
extra : rebase_source : 5e9af4f0ffacaaf08ecee4e6018bed1ee4a74047
extra : histedit_source : b73144f07097982236038c3efb391f6b7d00e5ed
This commit is contained in:
Brian Birtles 2016-12-02 08:58:19 +09:00
Родитель 6b50df2d34
Коммит 2a87280203
2 изменённых файлов: 17 добавлений и 13 удалений

Просмотреть файл

@ -143,18 +143,6 @@ for (let property in gMozillaSpecificProperties) {
+ from + "' and '" + to + "' with keyframe easing");
}
function propertyToIDL(property) {
var prefixMatch = property.match(/^-(\w+)-/);
if (prefixMatch) {
var prefix = prefixMatch[1] === "moz" ? "Moz" : prefixMatch[1];
property = prefix + property.substring(prefixMatch[0].length - 1);
}
// https://drafts.csswg.org/cssom/#css-property-to-idl-attribute
return property.replace(/-([a-z])/gi, function(str, group) {
return group.toUpperCase();
});
}
function testAnimationSamples(animation, idlName, testSamples) {
const target = animation.effect.target;
testSamples.forEach(testSample => {

Просмотреть файл

@ -137,6 +137,22 @@ function addStyle(t, rules) {
}
}
/**
* Takes a CSS property (e.g. margin-left) and returns the equivalent IDL
* name (e.g. marginLeft).
*/
function propertyToIDL(property) {
var prefixMatch = property.match(/^-(\w+)-/);
if (prefixMatch) {
var prefix = prefixMatch[1] === 'moz' ? 'Moz' : prefixMatch[1];
property = prefix + property.substring(prefixMatch[0].length - 1);
}
// https://drafts.csswg.org/cssom/#css-property-to-idl-attribute
return property.replace(/-([a-z])/gi, function(str, group) {
return group.toUpperCase();
});
}
/**
* Promise wrapper for requestAnimationFrame.
*/
@ -214,7 +230,7 @@ if (opener) {
}
/**
* Return a new MutaionObserver which started observing |target| element
* Return a new MutationObserver which started observing |target| element
* with { animations: true, subtree: |subtree| } option.
* NOTE: This observer should be used only with takeRecords(). If any of
* MutationRecords are observed in the callback of the MutationObserver,