This question already has answers here:
Object.defineProperty alternative for IE8
(2 answers)
Closed 8 years ago.
I'm working on a JSON Query language, project which is working fine in every browser except IE8.
I'm getting this Object doesn't support this action in IE8.
Object.defineProperty(FJQL, c, {
get: function(){
return (new Query(this, this.records))[c];
}
});
Is there any alternative solution to this?
Thanks....
IE8 does not support getter/setter functions on properties of non DOM objects.
So here you would need to use full getter functions
Please have a look through here.It gives you Answer.:)
Related
This question already has answers here:
Support for ES6 in Internet Explorer 11
(1 answer)
IE11 gives SCRIPT1002 error when defining class in javascript
(3 answers)
Closed 4 years ago.
I am having issues with a site build where the page is not displaying properly in IE11. The site displays correctly in chrome, firefox, and edge.
The error seems to break all the javascript from the file of the error. The file is responsible for handling parts of the layout, so when it fails it causes various sections on the page to not render properly.
The error message is "Script1010" and points to the following line of code:
function animate({ draw, duration }) {
...
}
I've not been able to identify why IE cannot process this line. The closest thing to answer I've seen is the following post that suggests that "draw" or "duration" might be reserved words in IE. But changing them caused the same error to occur.
Any suggestions or pointers?
EDIT: Thanks for the replies. Figured I would clarify the question as a foot note for similar searches, or even just for myself. As pointed out below, the question boils down to "Does IE support ES6 object destructuring?". Turns out object destructuring does not work in IE.
You are using ES6 to destructure the arguments. Internet Explorer does not support ES6.
You'll either have to rewrite it using ES5 or use a transpiler like Babel to transpile your code into ES5.
EDIT: If this is the only occurrence of ES6, I'd suggest rewriting it, but otherwise I'd use Babel.
function animate(arg) {
var draw = arg.draw
var duration = arg.duration
...
}
This question already has answers here:
Where can I find javascript native functions source code? [duplicate]
(3 answers)
Closed 1 year ago.
For example, i want to know how the querySelector method was built. I checked on MDN but there's only examples that show how to use it.
I also tried to check in the console.log but nothing readable.
There is a non-standard method to do this. Please be aware that it is not fully cross-browser compatible and shouldn't be used in a production environment.
function hello(){
return "Hi!";
}
console.log(hello.toSource());
See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/toSource for more.
Edit:
To see the source code of a built-in function, you will need to look at the engine source. This varies browser to browser. For example, Chrome uses the V8 engine. See https://github.com/v8/v8
This question already has answers here:
Javascript ES6 cross-browser detection
(10 answers)
Closed 7 years ago.
My js classes works fine in Chrome, but when I test in IE for example, the script fails as expected, giving an ugly syntax error.
Is there someway to test if the clients browser can handle ES6 Classes in javascript?
Technically you could
try { eval('"use strict"; class foo {}'); } catch (e) { console.log(e); }
practically I don't see it's reasonable to prefer it to transpiling at least these days.
This question already has answers here:
What does ‘::’ (double colon) do in javascript for events?
(6 answers)
Double colons in function declaration in Javascript?
(1 answer)
Closed 9 years ago.
I recently came upon this code on the web :
function window::onload() {
alert('onload!');
}
This (strange) syntax is only working in Internet Explorer (IE 8 in my case) and I wasn't sure of how it was called so I could search for it.
I simply want to know if there is some documentation related to this type of functions and if so, how are they called ?
That is automatic event binding in JScript, similar to the Object_EventName naming convention in VBScript.
See: Scripting Events
Supposedly it has meen removed in later version of Internet Explorer, just as some other rarely used non-standard features.
MS-ES5EX ECMAScript extension for Event Handler Function Definitions
http://msdn.microsoft.com/en-us/library/ff955429.aspx
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
IE9 equivalent of querySelectorAll
I'm trying to get all elements with the classname "video" in some JS running in IE9. I'm using var videopanels = document.querySelectorAll(".video"); which is working great in Chrome.
Unfortunately I'm getting this error when I watch document.querySelectorAll(".video") in the debugger:
document.querySelectorAll(".video")
Object doesn't support property or method 'querySelectorAll'
Error
However, when I watch document in the debugger (it shows up as a DispHTMLDocument) and open up the [Methods] list, I see
querySelectorAll()
querySelectorAll(v)
IHTMLDOMChildrenCollection
What's going on? How come I can see it in the debugger, but not (apparently) actually call or use it?
Change your doctype to html5 standards.
<!DOCTYPE html>
Also check IE9 isn't operating in compatibility mode as this may cause it to ignore some methods it supports.