JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script>
<div>
<div id="my-widget1">Testing 'nodeType' in jQuery version-3.1.1</div>
</div>
JavaScript
var data = {
colors: [{
id: 1,
color: "red"
}, {
id: 2,
color: "green"
}]
};
$(function() {
// the widget definition, where "custom" is the namespace,
// "widget1" is the widget name
$.widget("custom.widget1", {
options: {
data: null
},
_create: function() {
this.options.data.colors[0].nodeType = function() {};
$(this.element).widget2({
data: this.options.data.colors[0]
});
this.options.data.colors[0].nodeType = null;
}
});
// the widget definition, where "custom" is the namespace,
// "widget2" is the widget name
$.widget("custom.widget2", {
// default options
options: {
data: null
},
// The constructor
_create: function() {
// This condition gets equal in jQuery version '1.11.2' but not in version '3.1.1'
// This is beacause of "nodeType()" supported in '1.11.2'.
var isDataEqual = this.options.data == data.colors[0];
alert("jquery version : " + jQuery.fn.jquery + "\n" + "isDataEqual : " + isDataEqual);
},
});
// Initialize with default options
$("#my-widget1").widget1({
data: data
});
});