当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript nerv-utils.doc类代码示例

本文整理汇总了TypeScript中nerv-utils.doc的典型用法代码示例。如果您正苦于以下问题:TypeScript doc类的具体用法?TypeScript doc怎么用?TypeScript doc使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了doc类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: mountVNode

export function mountVNode (vnode: VNode, isSvg?: boolean, parentContext?, parentComponent?) {
  if (vnode.isSvg) {
    isSvg = true
  } else if (vnode.type === 'svg') {
    isSvg = true
  /* istanbul ignore next */
  } else if (!isSupportSVG) {
    isSvg = false
  }
  if (isSvg) {
    vnode.namespace = SVG_NAMESPACE
    vnode.isSvg = isSvg
  }
  const domNode = !isSvg
    ? doc.createElement(vnode.type)
    : doc.createElementNS(vnode.namespace, vnode.type)
  setProps(domNode, vnode, isSvg as boolean)
  if (vnode.type === 'foreignObject') {
    isSvg = false
  }
  const children = vnode.children
  if (isArray(children)) {
    for (let i = 0, len = children.length; i < len; i++) {
      mountChild(children[i] as VNode, domNode, parentContext, parentComponent, isSvg)
    }
  } else {
    mountChild(children as VNode, domNode, parentContext, parentComponent, isSvg)
  }
  vnode.dom = domNode
  if (vnode.ref !== null) {
    Ref.attach(vnode, vnode.ref, domNode)
  }
  return domNode
}
开发者ID:lineCode,项目名称:nerv,代码行数:34,代码来源:create-element.ts

示例2: processOnPropertyChangeEvent

/* istanbul ignore next */
function processOnPropertyChangeEvent (node, handler) {
  propertyChangeActiveHandler = handler
  if (!bindFocus) {
    bindFocus = true
    doc.addEventListener(
      'focusin',
      () => {
        unbindOnPropertyChange()
        bindOnPropertyChange(node)
      },
      false
    )
    doc.addEventListener('focusout', unbindOnPropertyChange, false)
  }
}
开发者ID:lineCode,项目名称:nerv,代码行数:16,代码来源:event.ts

示例3: detachEvent

export function detachEvent (
  domNode: Element,
  eventName: string,
  handler: Function
) {
  eventName = fixEvent(domNode, eventName)
  if (eventName === ONPROPERTYCHANGE) {
    return
  }
  const delegatedRoots = delegatedEvents.get(eventName)
  if (unbubbleEvents[eventName] === 1 && delegatedRoots) {
    const event = delegatedRoots.get(domNode)
    if (event) {
      domNode.removeEventListener(parseEventName(eventName), event.event, false)
      /* istanbul ignore next */
      const delegatedRootsSize = delegatedRoots.size
      if (delegatedRoots.delete(domNode) && delegatedRootsSize === 0) {
        delegatedEvents.delete(eventName)
      }
    }
  } else if (delegatedRoots && delegatedRoots.items) {
    const items = delegatedRoots.items
    if (items.delete(domNode) && items.size === 0) {
      doc.removeEventListener(
        parseEventName(eventName),
        delegatedRoots.event,
        false
      )
      delegatedEvents.delete(eventName)
    }
  }
}
开发者ID:lineCode,项目名称:nerv,代码行数:32,代码来源:event.ts

示例4: createVoid

export function createVoid () {
  const dom = doc.createTextNode('')
  return {
    dom,
    vtype: VType.Void
  }
}
开发者ID:lineCode,项目名称:nerv,代码行数:7,代码来源:create-void.ts

示例5:

 doc.addEventListener('selectionchange', () => {
   const el = doc.activeElement
   if (detectCanUseOnInputNode(el)) {
     const ev = doc.createEvent('CustomEvent')
     ev.initCustomEvent('input', true, true, {})
     el.dispatchEvent(ev)
   }
 })
开发者ID:lineCode,项目名称:nerv,代码行数:8,代码来源:event.ts

示例6: createElement

function createElement (
  vnode: VirtualNode | VirtualNode[],
  isSvg?: boolean,
  parentContext?,
  parentComponent?
): Element | Text | Comment | DocumentFragment | null {
  let domNode
  if (isValidElement(vnode)) {
    const vtype = vnode.vtype
    if (vtype & (VType.Composite | VType.Stateless)) {
      domNode = (vnode as CompositeComponent).init(parentContext, parentComponent)
      options.afterMount(vnode as CompositeComponent)
    } else if (vtype & VType.Text) {
      domNode = doc.createTextNode((vnode as any).text);
      (vnode as any).dom = domNode
    } else if (vtype & VType.Node) {
      domNode = mountVNode(vnode as any, isSvg, parentContext, parentComponent)
    } else if (vtype & VType.Void) {
      domNode = (vnode as any).dom
    }
  } else if (isString(vnode) || isNumber(vnode)) {
    domNode = doc.createTextNode(vnode as string)
  } else if (isNullOrUndef(vnode) || (vnode as any) === false) {
    domNode = doc.createTextNode('')
  } else if (isArray(vnode)) {
    domNode = doc.createDocumentFragment()
    vnode.forEach((child) => {
      if (!isInvalid(child)) {
        const childNode = createElement(child, isSvg, parentContext, parentComponent)
        if (childNode) {
          domNode.appendChild(childNode)
        }
      }
    })
  } else {
    throw new Error('Unsupported VNode.')
  }
  return domNode
}
开发者ID:lineCode,项目名称:nerv,代码行数:39,代码来源:create-element.ts


注:本文中的nerv-utils.doc类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。