Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
XUL:attribute:left
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  12 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
ramaboule  
View profile  
 More options Oct 30 2006, 5:11 am
Newsgroups: mozilla.dev.tech.xul
From: "ramaboule" <julien.bo...@gmail.com>
Date: 30 Oct 2006 02:11:35 -0800
Local: Mon, Oct 30 2006 5:11 am
Subject: XUL:attribute:left
Hi,

In the documentation for this attribute
(http://developer.mozilla.org/en/docs/XUL:Attribute:left), it is said
that the type is integer.

However, when I use it in javascript, the left property is a string
(please see the example below).

Is there an inconsistency here or am I missing something? My guess is
that this is the generic way XUL attribute values are exported to
javascript.

Thanks,

     Julien.

/////////////////////////////////////////////////////////////////////////// ////
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>

<window id="main-window" title="test-left" width="400" height="300"

xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

  <script>
    function buttonClicked(event) {
        var button = event.target;
        alert("left attribute of " + button.id +
              " is of type " + typeof(button.left) +
              " and has value " + button.left);
    }
  </script>

  <stack flex="1">
    <button id="my-button" left="100" top="200" label="Click me!"
      oncommand="buttonClicked(event)" />
  </stack>

</window>
/////////////////////////////////////////////////////////////////////////// ////


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Neil  
View profile  
 More options Nov 1 2006, 7:43 am
Newsgroups: mozilla.dev.tech.xul
From: Neil <n...@parkwaycc.co.uk>
Date: Wed, 01 Nov 2006 12:43:48 +0000
Local: Wed, Nov 1 2006 7:43 am
Subject: Re: XUL:attribute:left

ramaboule wrote:
>In the documentation for this attribute (http://developer.mozilla.org/en/docs/XUL:Attribute:left), it is said that the type is integer.

>However, when I use it in javascript, the left property is a string (please see the example below).

>Is there an inconsistency here or am I missing something? My guess is that this is the generic way XUL attribute values are exported to javascript.

I didn't write the documentation, but, apart from allowevents, collapsed
and hidden, XUL element properties have always been strings.

--
Warning: May contain traces of nuts.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ramaboule  
View profile  
 More options Nov 2 2006, 2:16 pm
Newsgroups: mozilla.dev.tech.xul
From: "ramaboule" <julien.bo...@gmail.com>
Date: 2 Nov 2006 11:16:05 -0800
Local: Thurs, Nov 2 2006 2:16 pm
Subject: Re: XUL:attribute:left
Hi Neil,

Thanks for the response. I would be helpful to update the doc then and
warn people about this: if you do foo.left += 10, you will have a
surprise... (actually I had one...).

    Julien.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nickolay Ponomarev  
View profile  
 More options Nov 2 2006, 5:12 pm
Newsgroups: mozilla.dev.tech.xul
From: "Nickolay Ponomarev" <asquee...@gmail.com>
Date: Fri, 3 Nov 2006 01:12:09 +0300
Local: Thurs, Nov 2 2006 5:12 pm
Subject: Re: XUL:attribute:left
On 2 Nov 2006 11:16:05 -0800, ramaboule <julien.bo...@gmail.com> wrote:
> Hi Neil,

> Thanks for the response. I would be helpful to update the doc then and
> warn people about this: if you do foo.left += 10, you will have a
> surprise... (actually I had one...).

Please feel free to update the doc yourself. The documentation is in
the wiki, letting anyone edit it.

Nickolay


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ramaboule  
View profile  
 More options Nov 2 2006, 9:30 pm
Newsgroups: mozilla.dev.tech.xul
From: "ramaboule" <julien.bo...@gmail.com>
Date: 2 Nov 2006 18:30:58 -0800
Local: Thurs, Nov 2 2006 9:30 pm
Subject: Re: XUL:attribute:left
Hi Nickolay,

Now that I'm given this responsability, I'm chickening out a little
bit...

The thing is that you could (maybe should) read the documentation as
just an XML reference and in this case, the current documentation makes
perfect sense: if you had to write a schema for this attribute, you
would say:
<xs:attribute name="left" type="xs:integer"/>

There are a lot of attributes in this case: top, flex etc... I haven't
checked the "boolean" ones but I will ASAP.

What I find confusing is that the mapping of these attributes in the
javascript DOM objects is string as opposed to a type similar to the
XML one.

So a better approach I think would be just to add a comment for all
these integer attributes saying something like:
WARNING: XUL attributes are exposed to javascript as string objects. If
you're doing any computation on these, please make sure to use the
parseInt function.

What do you think?

Thanks,

     Julien.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Neil Deakin  
View profile  
 More options Nov 2 2006, 10:09 pm
Newsgroups: mozilla.dev.tech.xul
From: Neil Deakin <enndea...@sympatico.ca>
Date: Thu, 02 Nov 2006 22:09:25 -0500
Local: Thurs, Nov 2 2006 10:09 pm
Subject: Re: XUL:attribute:left

ramaboule wrote:
> So a better approach I think would be just to add a comment for all
> these integer attributes saying something like:
> WARNING: XUL attributes are exposed to javascript as string objects. If
> you're doing any computation on these, please make sure to use the
> parseInt function.

This behaviour will probably change in the future though, such that
values are properly exposed as integers when needed.

Neil


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Neil  
View profile  
 More options Nov 3 2006, 5:50 am
Newsgroups: mozilla.dev.tech.xul
From: Neil <n...@parkwaycc.co.uk>
Date: Fri, 03 Nov 2006 10:50:05 +0000
Local: Fri, Nov 3 2006 5:50 am
Subject: Re: XUL:attribute:left

ramaboule wrote:
>Thanks for the response. I would be helpful to update the doc then and warn people about this: if you do foo.left += 10, you will have a surprise... (actually I had one...).

foo.left -= -10 works ;-)

--
Warning: May contain traces of nuts.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nickolay Ponomarev  
View profile  
 More options Nov 3 2006, 6:23 am
Newsgroups: mozilla.dev.tech.xul
From: "Nickolay Ponomarev" <asquee...@gmail.com>
Date: Fri, 3 Nov 2006 14:23:18 +0300
Local: Fri, Nov 3 2006 6:23 am
Subject: Re: XUL:attribute:left
[Cross-posting to dev-mdc, perhaps someone there will be able to come
up with a way to clearly specify the "type" of attributes in the XUL
reference. Original thread is at
http://groups-beta.google.com/group/mozilla.dev.tech.xul/browse_threa...
]

On 2 Nov 2006 18:30:58 -0800, ramaboule <julien.bo...@gmail.com> wrote:

> The thing is that you could (maybe should) read the documentation as
> just an XML reference and in this case, the current documentation makes
> perfect sense: if you had to write a schema for this attribute, you
> would say:
> <xs:attribute name="left" type="xs:integer"/>

You're right about the attributes, which are always strings. From JS
you usually work with properties (e.g. |elem.left|) , which are
different from attributes.

So http://developer.mozilla.org/en/docs/XUL:Property:left is
definitely incorrect.

In any case, claiming that 'type' of something is an integer, when
it's in fact a string representation of an integer, is confusing. I'm
not sure how this should be fixed myself. Maybe put "string containing
an integer" in the type field or something?

> What I find confusing is that the mapping of these attributes in the
> javascript DOM objects is string as opposed to a type similar to the
> XML one.

Yep, as Neil said, it's unfortunate and probably will be fixed later.

> So a better approach I think would be just to add a comment for all
> these integer attributes saying something like:
> WARNING: XUL attributes are exposed to javascript as string objects. If
> you're doing any computation on these, please make sure to use the
> parseInt function.

If you add this to individual pages, it won't be seen by people
reading the XUL:(element) pages.

Nickolay


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Eric Shepherd  
View profile  
 More options Nov 3 2006, 11:35 am
Newsgroups: mozilla.dev.tech.xul
From: Eric Shepherd <esheph...@mozilla.com>
Date: Fri, 3 Nov 2006 11:35:08 -0500
Local: Fri, Nov 3 2006 11:35 am
Subject: Re: XUL:attribute:left
Hm.  Yeah, we need to do something about this.  Probably exactly that  
way, by changing the type to "string containing an integer" or  
possibly adding a note to each page indicating that the integers are  
represented in strings.

Eric Shepherd
Developer Documentation Lead
she...@mozilla.com

On Nov 3, 2006, at 6:23 AM, Nickolay Ponomarev wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Eric Shepherd  
View profile  
 More options Nov 3 2006, 2:25 pm
Newsgroups: mozilla.dev.tech.xul
From: Eric Shepherd <esheph...@mozilla.com>
Date: Fri, 3 Nov 2006 14:25:14 -0500
Local: Fri, Nov 3 2006 2:25 pm
Subject: Re: XUL:attribute:left
The more help we get, the better. :)

Eric Shepherd
Developer Documentation Lead
she...@mozilla.com

On Nov 3, 2006, at 1:23 PM, Julien Boeuf wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nickolay Ponomarev  
View profile  
 More options Nov 7 2006, 9:29 am
Newsgroups: mozilla.dev.tech.xul
From: "Nickolay Ponomarev" <asquee...@gmail.com>
Date: Tue, 7 Nov 2006 17:29:02 +0300
Local: Tues, Nov 7 2006 9:29 am
Subject: Re: XUL:attribute:left
On 11/7/06, Julien Boeuf <julien.bo...@gmail.com> wrote:
> Hi all,

> I've updated the doc for these attributes:
> http://developer.mozilla.org/en/docs/XUL_element_attributes

> I've also checked that the boolean attributes are exported correctly
> to javascript (into boolean properties and not "string representing a
> boolean").

Thanks for that. Note, however, that *all* attributes are strings
(while _properties_ can be of varying types). Right now the
XUL_element_attributes page looks like some _attributes_ are strings,
while some are booleans, which is confusing.

Nickolay


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Eric Shepherd  
View profile  
 More options Nov 7 2006, 1:18 pm
Newsgroups: mozilla.dev.tech.xul
From: Eric Shepherd <esheph...@mozilla.com>
Date: Tue, 7 Nov 2006 13:18:48 -0500
Local: Tues, Nov 7 2006 1:18 pm
Subject: Re: XUL:attribute:left
Great job; I was just looking at those a little while ago.  Thanks!

Eric Shepherd
Developer Documentation Lead
she...@mozilla.com

On Nov 7, 2006, at 2:29 AM, Julien Boeuf wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »