Use of CSS selectors within the model's attrs is now disabled by default.
The PR also moves FSA demo from archive to demo (it's not using any deprecated features).
Motivation and Context
JSON markup far outperform String markup.
JSON selectors are indexed when rendered (perf)
There is little reason to use CSS selectors when you can convert the markup to JSON (using a template with the util.svg tag) and add the @selector attributes.
Migration guide
Before:
joint.dia.Element.define('Rectangle', {
attrs: {
'.rectangle': { // CSS Selector for the <rect/> element
fill: 'red'
}
}
}, {
markup: '<rect class="rectangle"/>',
});
Now (quick fix - per shape):
joint.dia.Element.define('Rectangle', {
attrs: {
'.rectangle': { // CSS Selector for the <rect> element
fill: 'red'
}
}
}, {
markup: '<rect class="rectangle"/>',
useCSSSelectors: true
});
Now (quick fix - global):
joint.config.useCSSSelectors = true;
joint.dia.Element.define('Rectangle', {
attrs: {
'.rectangle': { // CSS Selector for the <rect> element
fill: 'red'
}
}
}, {
markup: '<rect class="rectangle"/>'
});
Now (recommended fix):
joint.dia.Element.define('Rectangle', {
attrs: {
rectangle: { // JSON Selector for the <rect> element
fill: 'red'
}
}
}, {
markup: util.svg`<rect @selector="rectangle" />`,
});
Description
Use of CSS selectors within the model's
attrs
is now disabled by default.The PR also moves FSA demo from
archive
todemo
(it's not using any deprecated features).Motivation and Context
util.svg
tag) and add the@selector
attributes.Migration guide
Before:
Now (quick fix - per shape):
Now (quick fix - global):
Now (recommended fix):