How to use the incremental-dom.applyProp function in incremental-dom

To help you get started, we’ve selected a few incremental-dom examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github skatejs / skatejs / src / api / vdom.js View on Github external
// TODO when refactoring properties to not have to workaround the old
    // WebKit bug we can remove the "name in props" check below.
    //
    // NOTE: That the "name in elem" check won't work for polyfilled custom
    // elements that set a property that isn't explicitly specified in "props"
    // or "prototype" unless it is added to the element explicitly as a
    // property prior to passing the prop to the vdom function. For example, if
    // it were added in a lifecycle callback because it wouldn't have been
    // upgraded yet.
    //
    // We prefer setting props, so we do this if there's a property matching
    // name that was passed. However, certain props on SVG elements are
    // readonly and error when you try to set them.
    if ((name in props || name in elem || name in prototype) && !('ownerSVGElement' in elem)) {
      applyProp(elem, name, value);
      return;
    }

    // Explicit false removes the attribute.
    if (value === false) {
      applyDefault(elem, name);
      return;
    }

    // Handle built-in and custom events.
    if (name.indexOf('on') === 0) {
      const firstChar = name[2];
      let eventName;

      if (firstChar === '-') {
        eventName = name.substring(3);
github spectjs / spect / src / html.js View on Github external
attributes.is = (target, name, value) => {
  if (target.setAttribute) applyAttr(target, name, value)
  return applyProp(target, name, value)
}
attributes[symbols.default] = applyProp
github tailhook / khufu / khufu-runtime / src / index.js View on Github external
function applyAttribute(el, name, value) {
    let type = typeof value
    let prop = PROPERTIES[name]
    if(prop) {
        applyProp(el, prop, value)
    } else if (type === 'object' || type === 'function' || type == 'boolean') {
        applyProp(el, name, value)
    } else {
        applyAttr(el, name, value)
    }
}
github tailhook / khufu / khufu-runtime / src / index.js View on Github external
function applyAttribute(el, name, value) {
    let type = typeof value
    let prop = PROPERTIES[name]
    if(prop) {
        applyProp(el, prop, value)
    } else if (type === 'object' || type === 'function' || type == 'boolean') {
        applyProp(el, name, value)
    } else {
        applyAttr(el, name, value)
    }
}
github spectjs / spect / src / html-idom.js View on Github external
attributes.is = (target, name, value) => {
  if (target.setAttribute) applyAttr(target, name, value)
  return applyProp(target, name, value)
}
attributes[symbols.default] = applyProp