Files
angular.js/test/helpers/privateMocks.js
Henry Zhu ed3f799b5c style(*): disallow space after object keys, other rules
add `disallowSpaceAfterObjectKeys` and associated changes.
add `disallowMixedSpacesAndTabs` (no files changed)
add `disallowMultipleLineStrings` (no files changed)

Closes #9679
2014-10-19 11:09:16 +01:00

31 lines
612 B
JavaScript

'use strict';
function createMockStyleSheet(doc, wind) {
doc = doc ? doc[0] : document;
wind = wind || window;
var node = doc.createElement('style');
var head = doc.getElementsByTagName('head')[0];
head.appendChild(node);
var ss = doc.styleSheets[doc.styleSheets.length - 1];
return {
addRule: function(selector, styles) {
try {
ss.insertRule(selector + '{ ' + styles + '}', 0);
}
catch (e) {
try {
ss.addRule(selector, styles);
}
catch (e2) {}
}
},
destroy: function() {
head.removeChild(node);
}
};
}