20b28405082c20db2d9d7b33527db142d5f151f4183cce5748f6db2ee078ef7064c6ff1d17ed306ded407b8184b33fb90b7addfc93742a9173a88e80537b7f 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* @flow */
  2. // These util functions are split into its own file because Rollup cannot drop
  3. // makeMap() due to potential side effects, so these variables end up
  4. // bloating the web builds.
  5. import { makeMap, noop } from 'shared/util'
  6. export const isReservedTag = makeMap(
  7. 'template,script,style,element,content,slot,link,meta,svg,view,' +
  8. 'a,div,img,image,text,span,input,switch,textarea,spinner,select,' +
  9. 'slider,slider-neighbor,indicator,canvas,' +
  10. 'list,cell,header,loading,loading-indicator,refresh,scrollable,scroller,' +
  11. 'video,web,embed,tabbar,tabheader,datepicker,timepicker,marquee,countdown',
  12. true
  13. )
  14. // Elements that you can, intentionally, leave open (and which close themselves)
  15. // more flexible than web
  16. export const canBeLeftOpenTag = makeMap(
  17. 'web,spinner,switch,video,textarea,canvas,' +
  18. 'indicator,marquee,countdown',
  19. true
  20. )
  21. export const isRuntimeComponent = makeMap(
  22. 'richtext,transition,transition-group',
  23. true
  24. )
  25. export const isUnaryTag = makeMap(
  26. 'embed,img,image,input,link,meta',
  27. true
  28. )
  29. export function mustUseProp (): boolean {
  30. return false
  31. }
  32. export function getTagNamespace (): void { }
  33. export function isUnknownElement (): boolean {
  34. return false
  35. }
  36. export function query (el: string | Element, document: Object) {
  37. // document is injected by weex factory wrapper
  38. const placeholder = document.createComment('root')
  39. placeholder.hasAttribute = placeholder.removeAttribute = noop // hack for patch
  40. document.documentElement.appendChild(placeholder)
  41. return placeholder
  42. }