From cb86dba3af20e2c686b2816879b88434f9c0deb3 Mon Sep 17 00:00:00 2001
From: Beka Westberg
Date: Wed, 24 Jul 2019 09:40:08 -0700
Subject: [PATCH] Fixes Custom Fields (Turtle) Demo Browser Support (#2697)
* Fixed firefox not displaying correctly.
* Fixed IE support.
---
demos/custom-fields/field_turtle.js | 11 +++++++++--
demos/custom-fields/index.html | 6 +++---
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/demos/custom-fields/field_turtle.js b/demos/custom-fields/field_turtle.js
index 353ae8c1e..120a94608 100644
--- a/demos/custom-fields/field_turtle.js
+++ b/demos/custom-fields/field_turtle.js
@@ -455,11 +455,18 @@ CustomFields.FieldTurtle.prototype.updateColour = function() {
var child = this.turtleGroup_.firstChild;
while(child) {
- // If it is a text node, or a non-turtle node.
- if (child.nodeType == 3 || !child.classList.contains('turtleBody')) {
+ // If it is a text node, continue.
+ if (child.nodeType == 3) {
child = child.nextSibling;
continue;
}
+ // Or if it is a non-turtle node, continue.
+ var className = child.getAttribute('class');
+ if (!className || className.indexOf('turtleBody') == -1) {
+ child = child.nextSibling;
+ continue;
+ }
+
child.style.fill = fillColour;
child.style.stroke = borderColour;
child = child.nextSibling;
diff --git a/demos/custom-fields/index.html b/demos/custom-fields/index.html
index 7f2048669..2e1270f67 100644
--- a/demos/custom-fields/index.html
+++ b/demos/custom-fields/index.html
@@ -40,16 +40,16 @@
-