Re: [Proto-Scripty] Re: Element.update not working with div inside a table

2011-02-16 Thread Jeffrey Lee
Shows how outdated my HTML is.  Thanks for the pointer.  Its funny, when I was 
googling around apparently once upon a time it was at least tolerated, if not 
officially acceptable, to have div as a child of table.
___
Jeffrey Lee
http://www.jeffreyalanlee.com
jlee...@gmail.com




On Feb 15, 2011, at 23:20 , T.J. Crowder wrote:

 Hi,
 
 That HTML is invalid. You can't have a `div` as a child of `table`:
 http://www.w3.org/TR/html5/tabular-data.html#the-table-element
 
 If you want to subdivide a table like that, you probably want `thead`
 (for your headers) and one or more `tbody` elements:
 
 table
  thead
tr
  thItem/th
   thTransaction Type/th
   thQuantity/th
  thAmount/th
   thTransaction comments/th
/tr
  /thead
  tbody id = transList
tr
  bunch of table data
/tr
tr
  bunch of table data
/trtr
   bunch of table data
/tr
  /tbody
 /table
 
 ...and then your update will have to be valid `tbody` content (e.g.,
 rows).
 
 Example:
 http://jsbin.com/evuxe3
 
 HTH,
 --
 T.J. Crowder
 Independent Software Engineer
 tj / crowder software / com
 www / crowder software / com
 
 On Feb 15, 10:59 pm, Jeff jlee...@gmail.com wrote:
 This is a rails generated webpage.  I've created a table definition as
 follows:
 
 table
   tr
 thItem/th
 thTransaction Type/th
 thQuantity/th
 thAmount/th
 thTransaction comments/th
   /tr
 
 div id = transList
 tr
bunch of table data
   /trtr
bunch of table data
   /trtr
 bunch of table data
   /tr
 /div
 /table
 
 If I execute a $('transList').update('Test') or frankly any other text
 or html, the existing table data remains, and the updated text is
 placed above the entire table.  However, if I do a view - source,
 this new data doesn't show up in the page source at all, only the old
 table data.
 
 I'm having this problem in both Safari and Firefox.  Any suggestions?
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 Prototype  script.aculo.us group.
 To post to this group, send email to prototype-scriptaculous@googlegroups.com.
 To unsubscribe from this group, send email to 
 prototype-scriptaculous+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/prototype-scriptaculous?hl=en.
 

-- 
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.



Re: [Proto-Scripty] Re: Element.update not working with div inside a table

2011-02-16 Thread Walter Lee Davis
Not in my memory of HTML, which begins in 1997. It's certainly  
possible to put that into a browser and see something. Browsers are  
designed to ignore or coerce invalid code as best they can, to  
preserve the intent where possible. But there's a mile of difference  
between the JavaScript DOM interpreter and the browser's HTML display  
engine.


JavaScript doesn't even receive the HTML as written in code from the  
browser when it's constructing its starting DOM tree, it uses the  
output of the browser's first pass at munging the input code stream  
into shape. This is why you can see a big difference between Firebug  
and view source, for example.


So whenever you are interacting directly with the DOM, as you do in  
Prototype Element#update or anything else that inserts elements into  
the DOM, you are relied on to insert something that makes sense in the  
context where it will be added. If you don't, you get an error or you  
get ignored.


One other example of this, directly related to tables: It's perfectly  
valid code to write table id=footrtdSomething/td/tr/ 
table, but it's more correct to write table  
id=footbodytrtdSomething/td/tr/tbody/table. Most  
browsers will silently add that missing intermediate element when the  
page loads.


So if you wanted to get a handle on your first row, and you used $ 
('foo').childElements()[0] (totally made-up example) then you might  
actually get a reference to the tbody -- the element you didn't  
actually code!


Now you're probably smarter than that, and you'd write $ 
('foo').down('tr') and get what you wanted, but that's just an example  
to make the point that the code you wrote isn't even guaranteed to be  
the code you're going to be talking to when you start messing with the  
DOM.


Walter

On Feb 16, 2011, at 10:15 AM, Jeffrey Lee wrote:

Shows how outdated my HTML is.  Thanks for the pointer.  Its funny,  
when I was googling around apparently once upon a time it was at  
least tolerated, if not officially acceptable, to have div as a  
child of table.

___
Jeffrey Lee
http://www.jeffreyalanlee.com
jlee...@gmail.com




On Feb 15, 2011, at 23:20 , T.J. Crowder wrote:


Hi,

That HTML is invalid. You can't have a `div` as a child of `table`:
http://www.w3.org/TR/html5/tabular-data.html#the-table-element

If you want to subdivide a table like that, you probably want `thead`
(for your headers) and one or more `tbody` elements:

table
thead
  tr
thItem/th
 thTransaction Type/th
 thQuantity/th
thAmount/th
 thTransaction comments/th
  /tr
/thead
tbody id = transList
  tr
bunch of table data
  /tr
  tr
bunch of table data
  /trtr
 bunch of table data
  /tr
/tbody
/table

...and then your update will have to be valid `tbody` content (e.g.,
rows).

Example:
http://jsbin.com/evuxe3

HTH,
--
T.J. Crowder
Independent Software Engineer
tj / crowder software / com
www / crowder software / com

On Feb 15, 10:59 pm, Jeff jlee...@gmail.com wrote:
This is a rails generated webpage.  I've created a table  
definition as

follows:

table
 tr
   thItem/th
   thTransaction Type/th
   thQuantity/th
   thAmount/th
   thTransaction comments/th
 /tr

div id = transList
tr
  bunch of table data
 /trtr
  bunch of table data
 /trtr
   bunch of table data
 /tr
/div
/table

If I execute a $('transList').update('Test') or frankly any other  
text

or html, the existing table data remains, and the updated text is
placed above the entire table.  However, if I do a view - source,
this new data doesn't show up in the page source at all, only the  
old

table data.

I'm having this problem in both Safari and Firefox.  Any  
suggestions?


--
You received this message because you are subscribed to the Google  
Groups Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com 
.
To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com 
.
For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en 
.




--
You received this message because you are subscribed to the Google  
Groups Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com 
.
To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com 
.
For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en 
.




--
You received this message because you are subscribed to the Google Groups Prototype 
 script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.