Open maxkfranz opened 7 years ago
ele.json() returns classes as an array
Does this mean that it would include classes as well as other data?
Is there any way currently to get the list of classes an element has?
Does this mean that it would include classes as well as other data?
classes: ['foo', 'bar']
versus classes: 'foo bar'
Is there any way currently to get the list of classes an element has?
ele.json().classes
Since a class
is a concept in Javascript now, maybe it's better to use classNames
? Ecosystem seems to be standardising on this.
Yes, but that wouldn't have to be a breaking (v4) change. The old key could still be supported.
Edit: We may want to use ele.classNames()
with the ideal signature in v3 and then in v4 make a breaking change so that ele.classes()
matches ele.classNames()
. See #2110
This issue is for discussing v4 API -- i.e. breaking API changes. If you have a general feature in mind that is additive w.r.t. API, then feel free to make an ordinary feature request and the corresponding pull request.
Brainstorming of improvements that would cause breaking changes for a potential, future v4:
Modernising:
package.json
. This breaks support for CJS code that is bundled by Webpack. See alsoexports
(e.g. is-promise).Promise
,Set
,Map
, etc.Improving formatting & naming:
ele.json()
returnsclasses
as an array0.5
is the same as50%
. In v3, if you specify0.5
, you will get0.5%
.{ nodes: [], edges: [] }
elements JSON format no longer the default forcy.json()
export. Instead use, the plain array format.core
selector tocy
, by default. Thecore
value should still work, but it won't be returned bycy.json()
.Improved defaults:
<position>-arrow-width
value tomatch-line
(previously1px
) (#3194 #3191)Removing deprecated features & other mistakes:
cy.forceRender()
. Deprecated long ago.ele.renderedStyle()
(Deprecated in #2223)cy.batchData()
. Deprecated long ago.concentric
scratch values when running the concentric layout. The programmer can store values themselves.cy.style()
to only be a JSON setter. Ref: https://github.com/cytoscape/cytoscape.js/issues/2637#issuecomment-600734097width: label
andheight: label
. Ref. #2713Moving features to external extensions or libraries:
cose
from the core bundle and make it an external extension. The force-directed layout that a programmer should choose by default isfcose
.selectionType: 'additive'
from the core lib and turn it into an extension