本文整理匯總了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;
}