robnyman / domassistant

Automatically exported from code.google.com/p/domassistant
1 stars 0 forks source link

Labels cannot be created with the 'for' attribute #2

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
$('x').create('label', { for : 'someinput' });

Works fine in Firefox but throws error on IE, as 'for' is a keyword.

Original issue reported on code.google.com by chengh...@gmail.com on 9 Jan 2008 at 6:24

GoogleCodeExporter commented 9 years ago
NB: My previous note has been corrected as follows: Domassistant compressed 
works, 
whereas the regular (non compressed) does not.
This is the new issue:

when i created an element AND have added an event to the source element (i used 
click), the child element disappears after the event happens.
The commented code is the event.
when uncommented, one can watch the effect.

The code is :

=====================
<html>
<head>
    <title>DomAssistant Tests</title>
    <meta http-equiv="Content-Type"
          content="text/html; charset=ISO-" />
<script type="text/javascript" src="DOMAssistantCompressed.2.5.7.js">
    </script>
<style type="text/css" media="screen">
#id01   {
    position: absolute; right: 500px; top: 0px
        margin: -10px auto;
        width: 200px;
        height: 150px;
        border: 2px groove red; solid #ccc;
        border-width: thick;
        background-color: magenta;
  }
#id02   {
        position: absolute; right: -400px; bottom: 160px
        margin: -10px auto;
        width: 200px;
        height: 450px;
        border: 2px groove red; solid #ccc;
        border-width: thick;
        background-color: silver;
}
#cont   {
        width: 1000px;
        height: 650px;
        border: 2px groove red; solid #ccc;
        border-width: thick;
        background-color: lightblue;
}
    </style>
</head>
<body>
<div id="cont">
    <div id="id01"
         class="CL01">
         <p>I am id="id01"</p>
    </div>
</div>

<hr size="20px" color="green">
<script type="text/javascript">

    $('cont','id01');
    $('id01').addContent('I am here!!!!!!!!!!!!!');
alert( "first");
    $('id01').replaceContent('I am there!!!!!!!!!!!!!');
alert( "Second");
/*
    $('id01').addEvent("mouseover",function (){
        $('id01').replaceContent('All is changed');
        });
     $('id01').removeEvent("mouseover");
alert( "Third");
*/
  $("id01").create("div" , {
      id: "id02",
      className: "CL02"
       }, true, "New Div id02");
alert( "Fourth");
    $("id02").addContent("DIV02!!");
alert( "fifth");
                $("id02").removeEvent("DIV02!!");
    </script>
</body>
</html>

Original comment by emile.co...@gmail.com on 14 Jan 2008 at 3:40

GoogleCodeExporter commented 9 years ago
emile,

The child elements of id01 disappear because its content is replaced with "All 
is 
changed".

Or did I missed something?

Original comment by chengh...@gmail.com on 14 Jan 2008 at 6:32

GoogleCodeExporter commented 9 years ago
chenghong,

The problem with the for attribute in IE is their incorrect implementation
(http://msdn2.microsoft.com/en-us/library/ms533872(VS.85).aspx). To make it 
work in
IE, one has to name the attribute htmlFor when it is created dynamically.

I'm not sure that DOMAssistant should handle this scenario, given the extra 
code for
a fairly unusual usage (meaning tht this is'n happening for everyone every time 
they
need to use the script), but rather that the developer has to specify an extra
htmlFor attribute as well when creating elements. Like this:

$('x').create('label', { for : 'someinput', htmlFor: 'someinput' });

emile,

I'm thinking the same thing as chenghong.

Original comment by robny...@gmail.com on 17 Jan 2008 at 12:43

GoogleCodeExporter commented 9 years ago

Original comment by robny...@gmail.com on 17 Jan 2008 at 12:48