1
Vote

TypeError: undefined is not a function at xmlNewAttribute

description

Hi,

It seems that datajs-1.1.2.js has some bug in the xmlNewAttribute function.
There's the code:
var attribute =
            dom.createAttributeNS && dom.createAttributeNS(namespaceURI, qualifiedName) ||
            dom.createNode(2, qualifiedName, namespaceURI || undefined);
There neither createAttributeNS nor createNode exists in the dom object (screenshot attached).
Exception I got was: "TypeError: undefined is not a function".

To make it works I just replaced this code with the following one:
var attribute = dom.createAttribute(qualifiedName);
Tested on the Chrome Version 34.0.1847.116.
OData.request(
    {
        requestUri: "...",
        method: "POST",
        headers: {
          "Accept": "application/atom+xml",
          "Content-Security-Policy": "default-src 'none'; script-src 'self'; connect-src: 'self'; img-src: 'self'; style-src: 'self';",
          "Content-Type": "application/atom+xml",
          "DataServiceVersion": "2.0",
          "X-Requested-With": "XMLHttpRequest"
        },
        data: {
          id: "..."
        }
     },
     function(data, response){
    console.log("OK");
     },
     function (err) {
    console.log(err.message);
     }
);

file attachments

comments

techmuc wrote Apr 14, 2014 at 7:32 PM

crbug.com/347506