fix(mvc.View): set style via options #2705
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Allow
style
attribute to be set via options.All other properties can be set either as a class property or as a constructor option.
Documentation
The documentation missing not only the
style
property but alsoevents
andconstructor()
.https://docs.jointjs.com/api/mvc/View/#properties
style
A hash of CSS properties that will be set as inline style on the view's el (
color: red;
, etc.), or a function that returns such a hash.constructor()
There are several special options that, if passed, will be attached directly to the view:
model
,collection
,el
,id
,className
,tagName
,attributes
,style
andevents
. If the view defines an initialize function, it will be called when the view is first created. If you'd like to create a view that references an element already in the DOM, pass in the element as an option:new View({el: existingElement})
events
The events hash (or method) can be used to specify a set of DOM events that will be bound to methods on your View through
delegateEvents
.JointJS will automatically attach the event listeners at instantiation time, right before invoking
initialize
.