mirror of https://github.com/artf/grapesjs.git
Browse Source
* wrap `ParserHtml().parseStyle` around a class method currently when the model is extended via the `.extend` method, the `parseStyle` property is "hoisted" from the parent to the child. ideally, it should be be located on the parent which is the `prototype` of the child. the consequence of this is that when you run: `Object.hasOwnProperty.call(child, 'parseStyle')`, you get `true`. this is problematic as `parseStyle` is required by `setStyle` of `Dom_Components::Model::Component` which expects `parseStyle` to exist on its prototype (`StyleableModel`). But `parseStyle` is "hoisted" to be the property of any component that extends `Dom_Components::Model::Component`, thus, `this.parseStyle` will always be `undefined` when its called by any method that exists in objects that are lower in the prototypal chain than the topmost object (where `parseStyle` is defined). If `setStyle` is called further down the prototypal chain, it throws the following error: `"this.parseStyle is not a function"` * fix: prevent requesting a new parser on each parsepull/4535/head
committed by
GitHub
2 changed files with 33 additions and 1 deletions
Loading…
Reference in new issue