本文整理汇总了TypeScript中app/utils/addStyle.addStyle函数的典型用法代码示例。如果您正苦于以下问题:TypeScript addStyle函数的具体用法?TypeScript addStyle怎么用?TypeScript addStyle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了addStyle函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: before
before(function() {
domElement = document.createElement('div');
initialStyle = {
'borderColor': 'black'
};
addStyle(domElement, initialStyle);
});
示例2: makeTextUselectable
export function makeTextUselectable(domElement) {
assert(_.isElement(domElement), 'makeTextUselectable expects the argument to be a DOM element');
addStyle(domElement, {
'-webkit-touch-callout': 'none',
'-webkit-user-select': 'none',
'-moz-user-select': 'none',
'-ms-user-select': 'none',
'user-select': 'none'
});
}
示例3: createDOMElement
export function createDOMElement(tagName, style, attributes) {
/* eslint complexity:0 */
assert(_.isString(tagName), 'createDOMElement expects the first argument, tagName, to be a DOM element');
if (style) assert(_.isPlainObject(style), 'createDOMElement expects the second argument, style, to be a hash');
if (attributes) assert(_.isPlainObject(attributes), 'createDOMElement expects the third argument, attributes, to be a hash');
var domElement = document.createElement(tagName);
if (style) addStyle(domElement, style);
if (attributes) _.each(attributes, setAttribute(domElement));
return domElement;
}
示例4: addStyle
assert.throws(function() {
addStyle(createDOMElement('div'), 42);
},
示例5: it
it('works for the happy path', function() {
addStyle(domElement, style);
assert.equal(domElement.style.color, style.color, 'sets the given style on the DOM element');
});
示例6: function
return function() {
addStyle(domElement, style);
};
示例7: unselectCurrentlySelectedOption
function unselectCurrentlySelectedOption() {
var option = domElement.children[selectedOptionIndex];
addStyle(option, OptionList.INITIAL_OPTION_BUTTON_STYLE);
}
示例8: selectOpton
function selectOpton(optionIndex) {
var option = domElement.children[optionIndex];
addStyle(option, OptionList.HOVER_OPTION_BUTTON_STYLE);
selectedOptionIndex = optionIndex;
}