Browse Source

Allow DOM elements for node titles (#3267)

**Note: ** This is a simple fix and should be easy to review.

Fix for #2579

- Adjusted node title definition in `options.js` to allow DOM elements
- Changed `BridgeObject()` in `util.js` so that DOM elements are *not* bridged.
revert-3409-performance
wimrijnders 7 years ago
committed by yotamberk
parent
commit
658dbc18e8
2 changed files with 11 additions and 5 deletions
  1. +1
    -1
      lib/network/options.js
  2. +10
    -4
      lib/util.js

+ 1
- 1
lib/network/options.js View File

@ -329,7 +329,7 @@ let allOptions = {
__type__: { object }
},
size: { number },
title: { string, 'undefined': 'undefined' },
title: { string, dom, 'undefined': 'undefined' },
value: { number, 'undefined': 'undefined' },
widthConstraint: {
minimum: { number },

+ 10
- 4
lib/util.js View File

@ -1238,10 +1238,16 @@ exports.selectiveBridgeObject = function (fields, referenceObject) {
exports.bridgeObject = function (referenceObject) {
if (typeof referenceObject == "object") {
var objectTo = Object.create(referenceObject);
for (var i in referenceObject) {
if (referenceObject.hasOwnProperty(i)) {
if (typeof referenceObject[i] == "object") {
objectTo[i] = exports.bridgeObject(referenceObject[i]);
if (referenceObject instanceof Element) {
// Avoid bridging DOM objects
objectTo = referenceObject;
} else {
objectTo = Object.create(referenceObject);
for (var i in referenceObject) {
if (referenceObject.hasOwnProperty(i)) {
if (typeof referenceObject[i] == "object") {
objectTo[i] = exports.bridgeObject(referenceObject[i]);
}
}
}
}

Loading…
Cancel
Save