File tree Expand file tree Collapse file tree 4 files changed +16
-27
lines changed Expand file tree Collapse file tree 4 files changed +16
-27
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ const banner =
1717
1818const weexFactoryPlugin = {
1919 intro ( ) {
20- return 'module.exports = function weexFactory (exports, renderer ) {'
20+ return 'module.exports = function weexFactory (exports, document ) {'
2121 } ,
2222 outro ( ) {
2323 return '}'
Original file line number Diff line number Diff line change 1- import TextNode from 'weex/runtime/text-node'
2-
31// this will be preserved during build
42const VueFactory = require ( './factory' )
53
64const instances = { }
75
8- const renderer = {
9- TextNode
10- }
11-
126/**
13- * Prepare framework config, basically about the virtual-DOM and JS bridge .
14- * @param { object } cfg
7+ * Prepare framework config.
8+ * Nothing need to do actually, just an interface provided to weex runtime.
159 */
16- export function init ( cfg ) {
17- renderer . Document = cfg . Document
18- renderer . Element = cfg . Element
19- renderer . Comment = cfg . Comment
20- }
10+ export function init ( ) { }
2111
2212/**
2313 * Reset framework config and clear all registrations.
2414 */
2515export function reset ( ) {
2616 clear ( instances )
27- delete renderer . Document
28- delete renderer . Element
29- delete renderer . Comment
3017}
3118
3219/**
@@ -182,7 +169,7 @@ export function receiveTasks (id, tasks) {
182169 */
183170function createVueModuleInstance ( instanceId , weex ) {
184171 const exports = { }
185- VueFactory ( exports , renderer )
172+ VueFactory ( exports , weex . document )
186173 const Vue = exports . Vue
187174
188175 const instance = instances [ instanceId ]
Original file line number Diff line number Diff line change 1- /* globals renderer */
2- // renderer is injected by weex factory wrapper
1+ /* globals document */
2+ // document is injected by weex factory wrapper
3+
4+ import TextNode from 'weex/runtime/text-node'
35
46export const namespaceMap = { }
57
68export function createElement ( tagName ) {
7- return new renderer . Element ( tagName )
9+ return document . createElement ( tagName )
810}
911
1012export function createElementNS ( namespace , tagName ) {
11- return new renderer . Element ( namespace + ':' + tagName )
13+ return document . createElement ( namespace + ':' + tagName )
1214}
1315
1416export function createTextNode ( text ) {
15- return new renderer . TextNode ( text )
17+ return new TextNode ( text )
1618}
1719
1820export function createComment ( text ) {
19- return new renderer . Comment ( text )
21+ return document . createComment ( text )
2022}
2123
2224export function insertBefore ( node , target , before ) {
Original file line number Diff line number Diff line change 1- /* globals renderer */
1+ /* globals document */
22
33import { makeMap } from 'shared/util'
44
@@ -34,8 +34,8 @@ export function getTagNamespace () { /* console.log('getTagNamespace') */ }
3434export function isUnknownElement ( ) { /* console.log('isUnknownElement') */ }
3535
3636export function query ( el , document ) {
37- // renderer is injected by weex factory wrapper
38- const placeholder = new renderer . Comment ( 'root' )
37+ // document is injected by weex factory wrapper
38+ const placeholder = document . createComment ( 'root' )
3939 placeholder . hasAttribute = placeholder . removeAttribute = function ( ) { } // hack for patch
4040 document . documentElement . appendChild ( placeholder )
4141 return placeholder
You can’t perform that action at this time.
0 commit comments