473,657 Members | 2,594 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

e4x weirdness : <toto/>.nodeKind type is not a function

I am using fifrefox 1.5.0.2 and I have modified the javascript shell
to deal with e4x.
Below is a session. I would have expected <toto/>.nodeKind to be of
type
"function".
Is this right?
Is this conformant to the spec?
Any comments?
$ <toto/>.nodeKind()
element
$ typeof <toto/>.nodeKind
xml
$ typeof function() {}
function

--
cognominal stef

Apr 20 '06 #1
1 1801
cognominal wrote:
I am using fifrefox 1.5.0.2 and I have modified the javascript shell
to deal with e4x.
You don't have to modify the JavaScript Shell for that.
For example, I tested with FireBug on Firefox 1.5.0.1/Linux.
Below is a session. I would have expected <toto/>.nodeKind to be of
type
"function".
Is this right?
You are right.
Is this conformant to the spec?


The displayed behavior (typeof <toto/>.nodeKind == "xml") does _not_
conform to ECMA-357. Subsection 7.1.5 (Method Invocation) states:

| object . methodName ( arguments )
|
| where arguments is a comma separated list of zero or more values. The
| method invocation notation is equivalent to constructing a new Reference r
| with base object set to object and property name set to a string literal
| containing the same sequence of characters as methodName, constructing
| an internal list l of the values in arguments, invoking the CallMethod
| operator (section 11.2.2.1) passing r and l as arguments and returning
| the result. [...]

| 1.2.2.1 CallMethod ( r , args )
| [...]
| Given a Reference r and a list of arguments args, the operation CallMethod
| performs the following steps:
|
| 1. Let f = r
| 2. Let base = null
| 3. If Type(r) is Reference
| a. Let base = GetBase(r)
| b. If base == null, throw a ReferenceExcept ion
| c. Let P = GetPropertyName (r)
| d. Let f be the result of calling the Object [[Get]] method with
| base as the this object and argument P
| e. If f == undefined and Type(base) is XMLList and
| base.[[Length]] == 1
| i. Let r0 be a new Reference with base object = base[0] and
| property name = P
| ii. Return the result of calling CallMethod(r0, args)
| recursively
| f. If f == undefined and Type(base) is XML and
| base.hasSimpleC ontent() == true
| i. Let r0 be a new Reference with
| base object = ToObject(ToStri ng(base)) and
| property name = P
| ii. Return the result of calling CallMethod(r0, args)
| recursively
| 4. If Type(f) is not Object, throw a TypeError exception
| 5. If f does not implement the internal [[Call]] method, throw a
| TypeError exception
| 6. If base is an activation object, base = null
| 7. Return the result of calling the [[Call]] method of f providing base
| as the this value and the list args as the argument values

Furthermore:

| 11.3.2 The typeof Operator
|
| [...]
| The production UnaryExpression : typeof UnaryExpression is evaluated as
| follows:
|
| 1. Let u be the result of evaluating UnaryExpression
| 2. If Type(u) is Reference and GetBase(u) is null, return "undefined"
| 3. Return a string determined by Type(GetValue(u )) according to the
| following table:
|
| Type Result
| ---------------------------------
| Undefined "undefined"
| Null "object"
| Boolean "boolean"
| Number "number"
| String "string"
| XML "xml"
| XMLList "xml"
| Object (native and "object"
| doesn't implement
| [[Call]])
| Object (native and "function"
| implements [[Call]])

The last two rows are relevant. We are talking about the built-in
method "nodeKind" (ECMA-357, 13.4.4.25), which is a _native_ Function
_object_ (the Type operator, defined in ECMA-262 Ed. 3 Final would
return Object). Obviously, `<toto/>.nodeKind' could be [[Call]]ed,
to return "element", as specified in subsection 11.1.4 (XML Initialiser).

Therefore, the typeof operation on <toto/>.nodeKind should have
evaluated to "function", not "xml".
PointedEars
Apr 20 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3209
by: Eshrath | last post by:
Hi, What I am trying to do: ======================= I need to form a table in html using the xsl but the table that is formed is quite long and cannot be viewed in our application. So we are writing one object in C# which will take the entire table tag contents and renders. Ie., we need to pass "<table>………… <thead>……</thead>. <tr>.<td> <td>..<tr>.<td> <td> </table>" content to
2
10555
by: Donald Firesmith | last post by:
I am having trouble having Google Adsense code stored in XSL converted properly into HTML. The <> unfortunately become &lt; and &gt; and then no longer work. XSL code is: <script type="text/javascript"> <!]> </script> <script type="text/javascript"
2
15927
by: ESPNSTI | last post by:
Hi, I'm trying to use a generics dictionary with a key class that implements and needs IComparable<>. However when I attempt to use the dictionary, it doesn't appear to use the IComparable<> to find the key. In the example below, accessing the dictionary by using the exact key object that was used to add to the dictionary works. (see code comment 1). However, if I attempt to access the dictionary by using a key object that
3
2758
by: | last post by:
I have been researching articles on google on how to create a simple RSS feed that sucks <title><blurb><link><date> out of a sql server 2000 database via an aspx page. I know it has to be pushed into a <xml> document but not sure which direction to take. Is there perhaps a starter document which uses sql server as the data source I can tap into.
5
1583
by: Luke | last post by:
Built-in functions don't bind to classes like regular functions. Is this intended? (I do notice that the Python Reference Manual sec 3.2 under "Class Instance" refers to a "user-defined function"). Any ideas what the reason is for this distinction between build-in functions and normal functions? It's rather inconvenient when implementing some methods (not the whole class) in a C extension :-( $ python
3
3367
by: ajay2552 | last post by:
Hi, I have a query. All html tags start with < and end with >. Suppose i want to display either '<' or '>' or say some text like '<Company>' in html how do i do it? One method is to use &lt, &gt ,&ltCompany&gt to display '<', '>' and '<Company>' respectively. But is there any freeware code available which could implement the above functionality without having to use &gt,&lt and such stuff???
14
3137
by: Michael | last post by:
Since the include function is called from within a PHP script, why does the included file have to identify itself as a PHP again by enclosing its code in <?php... <?> One would assume that the PHP interpreter works like any other, that is, it first expands all the include files, and then parses the resulting text. Can anyone help with an explanation? Thanks, M. McDonnell
2
2052
by: -Karl | last post by:
Couls someone please advise me on this error. What I am trying to do is be able to convert an XML document into arrays. I read that the subs & functions have to be in <scripttags. Thanks! Error: BC30456: 'Read_DOM' is not a member of
3
2937
by: newbie | last post by:
Same thing g++ complains when using hash_map<>, but is happy with map<--I understand hahs_map is not standardized, but since the compiler didn't complain something like 'hash_map<not defined', I suppose it's supported and should behave well when I used it correctly. BUT it didn't. Here is my code snippet: class MyKey { public: virtual void foo() { return; }
0
8392
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8823
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8730
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8605
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6163
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4301
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1950
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1607
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.