As innerHTML is a property of the HTMLElement object, it appears that Intellisense in WebMatrix only provides support to the node and element objects only. Note that with JavaScript as a weak-typed language, Intellisense has to be essentially programmed
to know what properties and functions are associated, so not all properties and functions may be supported for JavaScript Intellisense.
Christopher Reed, MCT, MCPD, MCTS, Microsoft Specialist, MTA
"The oxen are slow, but the earth is patient."
Marked as answer by lukaba85 on Dec 20, 2012 07:39 AM
I would say that this is something that Microsoft would have to handle as this would be directly associated with their own JavaScript product, JScript.
Keep in mind that Intellisense is a tool. Don't depend on it for everything. If you already know the features you're looking, just type it in.
Also, look to use jQuery which can handle almost everything that JavaScript can do, but in a more user-friendly manner, with Intellisense.
Christopher Reed, MCT, MCPD, MCTS, Microsoft Specialist, MTA
"The oxen are slow, but the earth is patient."
Marked as answer by lukaba85 on Jan 22, 2013 01:22 PM
We don't do any sort of manage to detect what type of element you've selected with getElementById, so we really don't have a way to know for sure that it's an HTML element that supports the property. This is consistent with how Visual Studio 2010 behaves.
That having been said, this behavior has been changed in Visual Studio 2012. We moved from a strict W3C DOM list to one that includes common properties and methods, one of which includes innerHTML.
Changing this in WebMatrix wouldn't be easy, though it's something we could consider if there's enough people asking for a change:
lukaba85
Member
4 Points
9 Posts
HTML Element Object methods intellisense in WebMatrix
Dec 19, 2012 01:10 PM|LINK
Hi Guys,
I'm a begineer and maybe this is a simple question for most of you but in web matrix 2 I can't get to see the HTML methods in the intellisense.
If, inside of <script> tag I write:
document.getElementbyId("myID"). I expect to see a list of commono javascripts methods like "innerHTML".
I get lots of methods and properties but not innerHTML and other common HTML element's methods and properties.
How can you explain that?
Thanks a lot in advance
Careed
All-Star
18764 Points
3637 Posts
Re: HTML Element Object methods intellisense in WebMatrix
Dec 19, 2012 03:13 PM|LINK
As innerHTML is a property of the HTMLElement object, it appears that Intellisense in WebMatrix only provides support to the node and element objects only. Note that with JavaScript as a weak-typed language, Intellisense has to be essentially programmed to know what properties and functions are associated, so not all properties and functions may be supported for JavaScript Intellisense.
"The oxen are slow, but the earth is patient."
lukaba85
Member
4 Points
9 Posts
Re: HTML Element Object methods intellisense in WebMatrix
Dec 19, 2012 03:54 PM|LINK
thanks for your answer.
Do you mean with that phrase that there is a way to program Intellisen in order to support Javascript of other functions?
Or is Microsoft that can only do that?
Thanks a lot again
Careed
All-Star
18764 Points
3637 Posts
Re: HTML Element Object methods intellisense in WebMatrix
Dec 19, 2012 04:33 PM|LINK
I would say that this is something that Microsoft would have to handle as this would be directly associated with their own JavaScript product, JScript.
Keep in mind that Intellisense is a tool. Don't depend on it for everything. If you already know the features you're looking, just type it in.
Also, look to use jQuery which can handle almost everything that JavaScript can do, but in a more user-friendly manner, with Intellisense.
"The oxen are slow, but the earth is patient."
lukaba85
Member
4 Points
9 Posts
Re: HTML Element Object methods intellisense in WebMatrix
Dec 20, 2012 07:39 AM|LINK
Thanks a lot for your very clear answer.
Best regards
justin.beckw...
Member
38 Points
4 Posts
Re: HTML Element Object methods intellisense in WebMatrix
Jan 03, 2013 06:28 PM|LINK
Greetings! As Careed mentioned, we're only exposing properties of the node and element objects in the W3C DOM:
http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-745549614
We don't do any sort of manage to detect what type of element you've selected with getElementById, so we really don't have a way to know for sure that it's an HTML element that supports the property. This is consistent with how Visual Studio 2010 behaves. That having been said, this behavior has been changed in Visual Studio 2012. We moved from a strict W3C DOM list to one that includes common properties and methods, one of which includes innerHTML.
Changing this in WebMatrix wouldn't be easy, though it's something we could consider if there's enough people asking for a change:
https://webmatrix.uservoice.com
As mentioned, using jQuery would certaintly make this kind of thing easier :) Hopefully this helps answer your question!