JSFiddle - React, Tailwind, and code Playground
HTML
<html>
<head>
<title>JQuery.extend Test</title>
</head>
<body bgcolor="#000000" onload='runTest();'>
<div id='console' style='color:#FFFFFF;'></div>
</body>
</html>
JavaScript
function SimpleObject(test_scalar){
this.t_scalar = test_scalar;
this.ToString = function(){
return "S: " + this.t_scalar;
}
}
function TestObject(test_scalar,test_array,test_object){
this.t_scalar = test_scalar;
this.t_object = test_object;
this.ToString = function(){
return "S: " + this.t_scalar + ", O: {" + this.t_object.ToString() + "}";
}
}
function Console(id){
this.console = document.getElementById(id);
this.write = function(str,color){
if(str!=undefined){
var textElement = this.console.appendChild(document.createElement('text'));
textElement.appendChild(document.createTextNode(str));
if(color!=undefined)
textElement.setAttribute('style','color:'+color+';');
}
}
this.writeline = function(str,color){
if(str!=undefined){
var textElement = this.console.appendChild(document.createElement('text'));
textElement.appendChild(document.createTextNode(str));
if(color!=undefined)
textElement.setAttribute('style','color:'+color+';');
}
this.console.appendChild(document.createElement('br'));
}
}
function runTest(){
var out = new Console('console');
var t0 = new TestObject(3.14,new Array(3,1,4,1,5,9,2),new TestObject(1.61,new Array(1,6,1,8,0,3,3),new SimpleObject(2)));
out.writeline("Original Values");
out.writeline("t0 - " + t0.ToString()+";");
out.writeline();
t0.t_scalar = 1; //works fine!
out.write("Level 1 Change - ");
out.writeline("Expected","#44FF44");
out.writeline("t0 - " + t0.ToString()+";");
out.writeline();
t0.t_object.t_scalar = 23; //works fine!
out.write("Level 2 Change - ");
out.writeline("Expected","#44FF44");
out.writeline("t0 - " + t0.ToString()+";");
out.writeline();
t0.t_object.t_object.t_scalar = 42; //works fine!
out.write("Level 3 Change - ");
...