Skip to content

Commit

Permalink
add a few comments around the null vs. undefined difference in script…
Browse files Browse the repository at this point in the history
… nodes returned by the parse
  • Loading branch information
smparkes committed Nov 9, 2009
1 parent c690b80 commit 72faeb1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions dist/env.js
Expand Up @@ -5173,6 +5173,10 @@ __extend__(HTMLDocument.prototype, {
var __elementPopped__ = function(ns, name, node){
// print('Element Popped: '+ns+" "+name+ " "+ node+" " +node.type+" "+node.nodeName);
var doc = __ownerDocument__(node);
// SMP: subtle issue here: we're currently getting two kinds of script nodes from the html5 parser.
// The "fake" nodes come with a type of undefined. The "real" nodes come with the type that's given,
// or null if not given. So the following check has the side-effect of ignoring the "fake" nodes. So
// something to watch for if this code changes.
var type = ( node.type === null ) ? "text/javascript" : node.type;
try{
if(node.nodeName.toLowerCase() == 'script' && type == "text/javascript"){
Expand Down
5 changes: 5 additions & 0 deletions dist/env.rhino.js
Expand Up @@ -146,6 +146,7 @@ var Envjs = function(){
write = document.write,
writeln = document.writeln,
okay = true;
// SMP: see also the note in html/document.js about script.type
var script_type = script.type === null ? "text/javascript" : script.type;
try{
if(script_type){
Expand Down Expand Up @@ -5800,6 +5801,10 @@ __extend__(HTMLDocument.prototype, {
var __elementPopped__ = function(ns, name, node){
// print('Element Popped: '+ns+" "+name+ " "+ node+" " +node.type+" "+node.nodeName);
var doc = __ownerDocument__(node);
// SMP: subtle issue here: we're currently getting two kinds of script nodes from the html5 parser.
// The "fake" nodes come with a type of undefined. The "real" nodes come with the type that's given,
// or null if not given. So the following check has the side-effect of ignoring the "fake" nodes. So
// something to watch for if this code changes.
var type = ( node.type === null ) ? "text/javascript" : node.type;
try{
if(node.nodeName.toLowerCase() == 'script' && type == "text/javascript"){
Expand Down
4 changes: 4 additions & 0 deletions src/html/document.js
Expand Up @@ -236,6 +236,10 @@ __extend__(HTMLDocument.prototype, {
var __elementPopped__ = function(ns, name, node){
// print('Element Popped: '+ns+" "+name+ " "+ node+" " +node.type+" "+node.nodeName);
var doc = __ownerDocument__(node);
// SMP: subtle issue here: we're currently getting two kinds of script nodes from the html5 parser.
// The "fake" nodes come with a type of undefined. The "real" nodes come with the type that's given,
// or null if not given. So the following check has the side-effect of ignoring the "fake" nodes. So
// something to watch for if this code changes.
var type = ( node.type === null ) ? "text/javascript" : node.type;
try{
if(node.nodeName.toLowerCase() == 'script' && type == "text/javascript"){
Expand Down
1 change: 1 addition & 0 deletions src/platform/core.js
Expand Up @@ -141,6 +141,7 @@ var Envjs = function(){
write = document.write,
writeln = document.writeln,
okay = true;
// SMP: see also the note in html/document.js about script.type
var script_type = script.type === null ? "text/javascript" : script.type;
try{
if(script_type){
Expand Down

0 comments on commit 72faeb1

Please sign in to comment.