XPathResult is undefined - javascript

I have the error "Uncaught TypeError: Cannot read property 'FIRST_ORDERED_NODE_TYPE' of undefined" in some cases (not always) when run next code:
var type = XPathResult.FIRST_ORDERED_NODE_TYPE;
At the same time next code works fine for the same cases:
if (XPathResult)
var type = XPathResult.FIRST_ORDERED_NODE_TYPE;
It seems error is raised by interpretator, but not in runtime. Probably the problem is related with activation of window object.
I have this workaround with check if object exists but i want to figure out what is the real problem. Any ideas?
UPD: The problem is reproducableonly in Chrome

Related

error happening in thrift

I'm getting this error when running my script. Not sure why this is happening. Seems like there may be a bug in Evernote's Thrift
TypeError: Cannot read property 'length' of undefined
at Buffer.write (buffer.js:733:13)
at Object.BinaryParser.fromString (/Users/sam/Documents/evernote/node_modules/evernote/lib/thrift/protocol/binaryProtocol.js:502:12)
at BinaryProtocol.writeString (/Users/sam/Documents/evernote/node_modules/evernote/lib/thrift/protocol/binaryProtocol.js:148:30)
at BinaryProtocol.writeType (/Users/sam/Documents/evernote/node_modules/evernote/lib/thrift/protocol/binaryProtocol.js:168:25)
at new Thrift.List.write (/Users/sam/Documents/evernote/node_modules/evernote/lib/thrift/thrift.js:275:20)
at new Thrift.Struct.write (/Users/sam/Documents/evernote/node_modules/evernote/lib/thrift/thrift.js:530:17)
at Thrift.Struct.write (/Users/sam/Documents/evernote/node_modules/evernote/lib/thrift/thrift.js:530:17)
at Thrift.Method.sendRequest (/Users/sam/Documents/evernote/node_modules/evernote/lib/thrift/thrift.js:162:15)
at NoteStoreClient.updateNote (/Users/sam/Documents/evernote/node_modules/evernote/lib/thrift/gen-js2/NoteStore.js:1700:8)
at /Users/sam/Documents/evernote/node_modules/evernote/lib/stores.js:106:14
NoteStore#updateNote takes a Note object as an argument. You should be able to instantiate it by new Evernote.Note(). Note that it seems you don't have to set title if you are not going to update it.

(IE9)Unable to get property 'dispatchEvent' of undefined or null reference

My code is:
var internal= $("span[title='expand']")[0];
var clickEvent = document.createEvent("MouseEvent");
clickEvent.initEvent("click",true,true);
internal.dispatchEvent(clickEvent);
and IE9 throws runtime error
Unable to get property 'dispatchEvent' of undefined or null reference
I am confused because IE9 starts supporting dispatchEvent. But IE10 AND IE11 works fine with the same code.
How can I solve it? Thanks!
Are you sure the local variable 'internal' is not undefined at the moment dispatchEvent is called?
Did the call to jQuery to fetch the span return a valid DOM Node?

problems getting the value of a field in a Ext.data.Model

I need to set values ​​in a text field, obtaining a data.Model these values​​, but when I run the function anywhere in the code, sends me this error:
Uncaught TypeError: Can not read property 'get' of undefined
But if I run it from a button works fine.
this is the code:
function SetterValues() {
var rec = store_usr.getAt(0);
Ext.getCmp('name_usr').setValue(rec.get("user"));
Ext.getCmp('nom_usr').setValue(rec.get("name"));
Ext.getCmp('ape_usr').setValue(rec.get("LastName"));
}
Help please! because I can not run it from anywhere in my code!
The error message you're receiving indicates that the rec variable is undefined. Are you sure that your store_usr exists, and is loaded? If so, does store_usr.getAt(0) return anything?

Can't choose an option on a configurable product, when i merge javascript

I have a bit of a problem. I have huge amount of JavaScript on my site, and when i am trying to merge it, i suddenly can't choose an option.
The console in Google Chrome shows this:
Uncaught TypeError: undefined is not a function
The code is simply to long
Uncaught TypeError: Cannot read property 'OptionsPrice' of undefined
<script>
var optionsPrice = new Product.OptionsPrice({"productId":"224","priceFormat":{"pattern":"%s\u00a0DKK ","precision":2,"requiredPrecision":2,"decimalSymbol":",","groupSymbol":".","groupLength":3,"integerRequired":1},"includeTax":"true","showIncludeTax":true,"showBothPrices":false,"productPrice":29,"productOldPrice":29,"priceInclTax":29,"priceExclTax":29,"skipCalculate":1,"defaultTax":25,"currentTax":25,"idSuffix":"_clone","oldPlusDisposition":0,"plusDisposition":0,"plusDispositionTax":0,"oldMinusDisposition":0,"minusDisposition":0,"tierPrices":[],"tierPricesInclTax":[]});
</script>
Uncaught TypeError: Cannot read property 'Config' of undefined
<script>
var spConfig = new Product.Config({"attributes":{"145":{"id":"145","code":"size","label":"St\u00f8rrelse","options":[{"id":"32","label":"10ml","price":"0","oldPrice":"0","products":["225","226","227","228"]},{"id":"31","label":"30ml","price":"30","oldPrice":"30","products":["229","230","231","232"]}]},"146":{"id":"146","code":"styrke","label":"Styrke","options":[{"id":"36","label":"0mg","price":"0","oldPrice":"0","products":["225","229"]},{"id":"35","label":"6mg","price":"0","oldPrice":"0","products":["226","230"]},{"id":"34","label":"12mg","price":"0","oldPrice":"0","products":["227","231"]},{"id":"33","label":"18mg","price":"0","oldPrice":"0","products":["228","232"]}]}},"template":"#{price}\u00a0DKK ","basePrice":"29","oldPrice":"29","productId":"224","chooseText":"--V\u00e6lg venligst--","taxConfig":{"includeTax":true,"showIncludeTax":true,"showBothPrices":false,"defaultTax":25,"currentTax":25,"inclTaxTitle":"Inkl. moms"}});
</script>
Uncaught Reference Error: Calendar is not defined
Calendar._DN = ["s\u00f8ndag","mandag","tirsdag","onsdag","torsdag","fredag","l\u00f8rdag"]; // full day names
I hope there is someway that you can help me.
I am on a Magento platform, with a custom template.
Thanks
This sounds like a syntax error in one of the JS files. Either in the one where Product is defined or where you get your first error.
Sometimes you miss a comma and your entire object is not defined. I would look for that first.
The easiest way is to use JSLint.
where is "Product" defined?
you should first have Product in your page! or is it defined in a closure function?

Chrome console shows Uncaught TypeError: Cannot read property 'start' of undefined

I've created extension and ported it for all browsers. My extension adds buttons above one of Georgian forum's textarea
http://i.imgur.com/5gjIE.png
But I have strange problem only with Google Chrome and Safari. If you click exactly on blue image (B) there is no error but if you click anywhere else on that button it shows Uncaught TypeError: Cannot read property 'start' of undefined error in console and automatically posts on that web-site.
Here is my extension's source http://pastebin.com/mxnBqDxS
Console shows that error is on 341 line var replaced = wrapper.start+val.substring(start, end)+wrapper.end;
Do you have any ideas why is this happening?
Thanks
Well the problem is here:
var method = ev.target.parentNode.id;
var wrapper = this._WRAPPERS[method];
wrapper is not getting set which means that _WRAPPERS[method] does not exist. You could put an alert in to show the value of method -- my guess is that would make the problem clear.

Categories