Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community Forums"document" unresolved for javascript files
https://www.eclipse.org/forums/index.php/mv/msg/66503/208876/#msg_208876
I wanted to try out the javascript editor for WTP R3.0 M5, so downloaded:
When authoring a Javascript file (e.g. test.js), I get code completion
fine for javascript'y things like function, var, etc. (great!) but oddly
a line like
document.getElementByID("something");
gets a compile error on 'document' being unresolved.
Am I missing something that will properly add in resolution to things
like document?
Thanks in advance,
Kevin]]>Kevin McGuire2008-02-20T23:33:06-00:00Re: "document" unresolved for javascript files
https://www.eclipse.org/forums/index.php/mv/msg/66503/208890/#msg_208890
> When authoring a Javascript file (e.g. test.js), I get code completion
> fine for javascript'y things like function, var, etc. (great!) but oddly
> a line like
> document.getElementByID("something");
> gets a compile error on 'document' being unresolved.
>
> Am I missing something that will properly add in resolution to things
> like document?
Possibly. Go to your project's Properties dialog and look for the
Javascript Libraries page. From Libraries tab you'll want to "Add
Runtime Library...", and choose the Base Web Browser Library. That
should make available the browser objects you're used to seeing.
---
Nitin Dahyabhai
Eclipse WTP Source Editing
IBM Rational]]>Nitin Dahyabhai2008-02-21T11:40:05-00:00Re: "document" unresolved for javascript files
https://www.eclipse.org/forums/index.php/mv/msg/66503/208915/#msg_208915
Btw, is this a bug? (Should I report it?) It seems that library should
be default available.
Final stupid question: shouldn't "document" with a lower case 'd' be
available in the ECMA bindings?
Kevin
Nitin Dahyabhai wrote:
> Kevin McGuire wrote:
>> When authoring a Javascript file (e.g. test.js), I get code completion
>> fine for javascript'y things like function, var, etc. (great!) but
>> oddly a line like
>> document.getElementByID("something");
>> gets a compile error on 'document' being unresolved.
>>
>> Am I missing something that will properly add in resolution to things
>> like document?
>
> Possibly. Go to your project's Properties dialog and look for the
> Javascript Libraries page. From Libraries tab you'll want to "Add
> Runtime Library...", and choose the Base Web Browser Library. That
> should make available the browser objects you're used to seeing.
>
> ---
> Nitin Dahyabhai
> Eclipse WTP Source Editing
> IBM Rational]]>Kevin McGuire2008-02-21T18:18:19-00:00Re: "document" unresolved for javascript files
https://www.eclipse.org/forums/index.php/mv/msg/66503/208962/#msg_208962
> Final stupid question: shouldn't "document" with a lower case 'd' be
> available in the ECMA bindings?
I think "document" is a variable only available if you set the super
type to a web Browser object. I don't know what "Document" refers
to, but I'm guessing it is a W3C DOM object, but then I'm not an
expert in Javascript. For all I know they're unrelated.
---
Nitin Dahyabhai
Eclipse WTP Source Editing
IBM Rational]]>Nitin Dahyabhai2008-02-22T16:41:50-00:00Re: "document" unresolved for javascript files
https://www.eclipse.org/forums/index.php/mv/msg/66503/208979/#msg_208979
Thanks for the response. Sorry I don't understand. The super type of
whom? I should be able to write:
<script type="text/javascript">
function doit() {
var newString = "hello world";
var content = document.getElementById("content");
alert(content);
content.innerHTML = newString;
}
</script>
Both document and alert() get compile errors (yet this is normal legal
javascript AFAIK and runs just fine in Firefox).
Btw, the "Document" choice is quite odd. Its a browser class alright
that you'll find in a Javascript book, but I don't think you typically
send static methods to it and code completion offers instance method
choices on the static.
The first one might be a bug or might be a UI issue (not guiding the
user to the right configation), the second is definitely fishy.
Its a very nice javascript editor otherwise! :)
Cheers,
Kevin McGuire
Nitin Dahyabhai wrote:
> Kevin McGuire wrote:
>> Final stupid question: shouldn't "document" with a lower case 'd' be
>> available in the ECMA bindings?
>
> I think "document" is a variable only available if you set the super
> type to a web Browser object. I don't know what "Document" refers to,
> but I'm guessing it is a W3C DOM object, but then I'm not an expert in
> Javascript. For all I know they're unrelated.
>
> ---
> Nitin Dahyabhai
> Eclipse WTP Source Editing
> IBM Rational]]>Kevin McGuire2008-02-22T19:25:24-00:00Re: "document" unresolved for javascript files
https://www.eclipse.org/forums/index.php/mv/msg/66503/209065/#msg_209065
by all .js (and .html files if in a web project).
By definition for .js files the super type is (an instance of) the Global()
object. When JavaScript is running within the context of a browser,
inheritance is Global()--->Window() and [an instance of]Window() is the
super type. 'document' is a field in the Window object of type Document().
-Brad
"Kevin McGuire" <eclipse@kevin.mcguireclan.net> wrote in message
news:fpn7ka$tdm$1@build.eclipse.org...
> Hi Nitin,
>
> Thanks for the response. Sorry I don't understand. The super type of
> whom? I should be able to write:
>
> <script type="text/javascript">
> function doit() {
> var newString = "hello world";
> var content = document.getElementById("content");
> alert(content);
> content.innerHTML = newString;
> }
> </script>
>
> Both document and alert() get compile errors (yet this is normal legal
> javascript AFAIK and runs just fine in Firefox).
>
> Btw, the "Document" choice is quite odd. Its a browser class alright that
> you'll find in a Javascript book, but I don't think you typically send
> static methods to it and code completion offers instance method choices on
> the static.
>
> I've logged:
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=219886 :: "document" shows
> as error even with ECMA 3 lib added
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=219880 :: Code completion
> offers illegal choices
>
> The first one might be a bug or might be a UI issue (not guiding the user
> to the right configation), the second is definitely fishy.
>
> Its a very nice javascript editor otherwise! :)
>
> Cheers,
> Kevin McGuire
>
>
> Nitin Dahyabhai wrote:
>> Kevin McGuire wrote:
>>> Final stupid question: shouldn't "document" with a lower case 'd' be
>>> available in the ECMA bindings?
>>
>> I think "document" is a variable only available if you set the super type
>> to a web Browser object. I don't know what "Document" refers to, but I'm
>> guessing it is a W3C DOM object, but then I'm not an expert in
>> Javascript. For all I know they're unrelated.
>>
>> ---
>> Nitin Dahyabhai
>> Eclipse WTP Source Editing
>> IBM Rational]]>Bradley Childs2008-02-25T15:20:30-00:00Re: "document" unresolved for javascript files
https://www.eclipse.org/forums/index.php/mv/msg/66503/209072/#msg_209072
Properties->JavaScript Libraries -> Global Order/Super Type and changing
the dropdown at the bottom of that page to "Window" I now have my little
example working.
I'll comment though that this isn't at all obvious (apparently <g>). So
there's some usability concern around getting novice developers going
quickly.
Thanks again,
Kevin McGuire
Bradley Childs wrote:
> The super type of a project is the type who's fields / methods are inherited
> by all .js (and .html files if in a web project).
>
> By definition for .js files the super type is (an instance of) the Global()
> object. When JavaScript is running within the context of a browser,
> inheritance is Global()--->Window() and [an instance of]Window() is the
> super type. 'document' is a field in the Window object of type Document().
>
>
>
> -Brad
> "Kevin McGuire" <eclipse@kevin.mcguireclan.net> wrote in message
> news:fpn7ka$tdm$1@build.eclipse.org...
>> Hi Nitin,
>>
>> Thanks for the response. Sorry I don't understand. The super type of
>> whom? I should be able to write:
>>
>> <script type="text/javascript">
>> function doit() {
>> var newString = "hello world";
>> var content = document.getElementById("content");
>> alert(content);
>> content.innerHTML = newString;
>> }
>> </script>
>>
>> Both document and alert() get compile errors (yet this is normal legal
>> javascript AFAIK and runs just fine in Firefox).
>>
>> Btw, the "Document" choice is quite odd. Its a browser class alright that
>> you'll find in a Javascript book, but I don't think you typically send
>> static methods to it and code completion offers instance method choices on
>> the static.
>>
>> I've logged:
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=219886 :: "document" shows
>> as error even with ECMA 3 lib added
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=219880 :: Code completion
>> offers illegal choices
>>
>> The first one might be a bug or might be a UI issue (not guiding the user
>> to the right configation), the second is definitely fishy.
>>
>> Its a very nice javascript editor otherwise! :)
>>
>> Cheers,
>> Kevin McGuire
>>
>>
>> Nitin Dahyabhai wrote:
>>> Kevin McGuire wrote:
>>>> Final stupid question: shouldn't "document" with a lower case 'd' be
>>>> available in the ECMA bindings?
>>> I think "document" is a variable only available if you set the super type
>>> to a web Browser object. I don't know what "Document" refers to, but I'm
>>> guessing it is a W3C DOM object, but then I'm not an expert in
>>> Javascript. For all I know they're unrelated.
>>>
>>> ---
>>> Nitin Dahyabhai
>>> Eclipse WTP Source Editing
>>> IBM Rational
>
>]]>Kevin McGuire2008-02-25T18:07:00-00:00