Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
static run(text, opt_appendFn) {
const style = globals.document.createElement('style');
style.innerHTML = text;
if (opt_appendFn) {
opt_appendFn(style);
} else {
globals.document.head.appendChild(style);
}
return style;
}
static run(text, opt_appendFn) {
const script = globals.document.createElement('script');
script.text = text;
if (opt_appendFn) {
opt_appendFn(script);
} else {
globals.document.head.appendChild(script);
}
exitDocument(script);
return script;
}
* is rendered. This method can be used to check if this behavior happens on
* the current browser.
* @return {boolean}
*/
static checkAttrOrderChange() {
if (features.attrOrderChange_ === undefined) {
const originalContent = '<div data-ref="" data-component=""></div>';
const element = globals.document.createElement('div');
append(element, originalContent);
features.attrOrderChange_ = originalContent !== element.innerHTML;
}
return features.attrOrderChange_;
}
}
features.animationElement_ = globals.document.createElement('div');
features.animationEventName_ = undefined;
features.attrOrderChange_ = undefined;
export default features;
static runFile(src, opt_callback, opt_appendFn) {
const script = globals.document.createElement('script');
script.src = src;
const callback = function() {
exitDocument(script);
opt_callback && opt_callback();
};
once(script, 'load', callback);
once(script, 'error', callback);
if (opt_appendFn) {
opt_appendFn(script);
} else {
globals.document.head.appendChild(script);
}
return script;
}
*/
this.initialConfig_ = opt_config || {};
/**
* Whether the element was rendered.
* @type {boolean}
*/
this.wasRendered = false;
/**
* The component's element will be appended to the element this variable is
* set to, unless the user specifies another parent when calling `render` or
* `attach`.
* @type {!Element}
*/
this.DEFAULT_ELEMENT_PARENT = globals.document.body;
this.setShouldUseFacade(true);
this.element = this.initialConfig_.element;
this.setUpRenderer_();
this.setUpDataManager_();
this.setUpSyncUpdates_();
this.on('stateChanged', this.handleComponentStateChanged_);
this.on('eventsChanged', this.onEventsChanged_);
this.addListenersFromObj_(this.dataManager_.get(this, 'events'));
this.created();
this.componentCreated_ = true;
if (opt_parentElement !== false) {
this.renderComponent(opt_parentElement);
static runFile(href, opt_callback, opt_appendFn) {
const link = globals.document.createElement('link');
link.rel = 'stylesheet';
link.href = href;
globalEvalStyles.runStyle(link, opt_callback, opt_appendFn);
return link;
}
toHtmlString(incDomFn) {
const element = globals.document.createElement('div');
IncrementalDOM.patch(element, incDomFn);
return element.innerHTML;
}
render(component) {
if (!component.element) {
component.element = globals.document.createElement('div');
}
component.informRendered();
}