You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by GitBox <gi...@apache.org> on 2018/12/03 07:36:24 UTC

[GitHub] ts0307 opened a new issue #1853: Registered custom component functions may override the framework's own functions

ts0307 opened a new issue #1853: Registered custom component functions may override the framework's own functions
URL: https://github.com/apache/incubator-weex/issues/1853
 
 
   The functions of the components registered by registerComponents are likely to override the functions of Element and Node. These functions are the following in the type Element: 
     'removeEvent',
     'toStyle',
     'appendChild',
     'clear',
     'fireEvent',
     'insertAfter',
     'insertBefore',
     'removeChild',
     'addEvent',
     'setAttr',
     'setAttrs',
     'setClassStyle',
     'setStyle',
     'setStyles',
     'toJSON',
     'toString',
   
   and In type Node is
   'destroy'
   
   What causes this? Because the registered custom component in Weex corresponds to the type WeexElement, it inherits from Element, and Element defines some functions that operate Node. These Nodes correspond to native components. If these functions are override, they are originally on Node. The called function becomes called directly on the native component.
   
   This will lead us to be familiar with the implementation details of weex, and can't use the above name to name the function of the custom component.
   
   So I recommend that all variable names that may be override by the user be prefixed with "$", as Vue does.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services