MrHackett / iui

Automatically exported from code.google.com/p/iui
MIT License
0 stars 0 forks source link

Unvalued attribute "selected" should be more lenient in allowed values and/or should be replaced with something else #15

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
The attribute test in line 131 of getSelectedPage
    if (... child.getAttribute("selected") == "true")
is a bit too restrictive.  It would be preferable if it accepted any truthy
value.  At the very least it should accept selected="selected" as an
alternative to selected="true".

Some XHTML template renderers (*cough* Genshi *cough*) like to play God. 
XHTML which is written as selected="true" will be delivered to the client
as selected="selected".  Thanks, python heroes, you saved me from actually
serving to my clients what I really did want to serve them!  :)

(The line ref above refers to version 7 in svn.)

Original issue reported on code.google.com by dhtml.bl...@gmail.com on 13 Sep 2007 at 4:28

GoogleCodeExporter commented 8 years ago
I had the same experience with Genshi (a Pythonic xml-centric template system 
that I
like a lot!). 

I'm using Genshi with TurboGears to generate iui pages. If you render them as 
XML,
when the JavaScript code goes element.innerHTML = "<p>foo</p>", it doesn't get 
parsed
and there are no child nodes. Apparently it's xml dom not html dom -- go 
figure. So I
switched the template to output html. But the problem was iui needs to use 
attributes
like selected="true". But the html serializer was rendering those as just 
SELECTED,
so the iui dialogs do not get selected properly.

I've worked around it on the server side, but I agree that it would be nice if 
iui
would accept html with SELECTED instead of selected="true". After all, in HTML, 
the
mere presence of SELECTED means that an item is selected. I think iui should
interpret SELECTED the same as HTML does, if it's going to use the same 
attribute as
HTML does. Another solution would be for iui to use a different attribute like
current="true" instead of one already used (and abused) by html. 

I monkey patched genshi.output.XHTMLSerializer._BOOLEAN_ATTRS to remove 
'select' from
the set of attributes that get munged, and it works ok for me now! But I wish 
there
were a better way to selectively neutralize and fine tune what the html 
serializer
did, on a per-template basis, not for the entire system.

-Don

Original comment by simhac...@gmail.com on 4 Nov 2008 at 7:44

GoogleCodeExporter commented 8 years ago
Here's a changeset that replaces [selected] with [shown] and also wraps the 
handling in getShown() and setShown() functions:

http://code.google.com/r/msgilligan-iui-angular/source/detail?r=5df60ddd399c6e58
961ff160b3ab57b7751a7421&name=msgilligan-angularjs-test

We might do something like this in release 0.6.0

Original comment by msgilli...@gmail.com on 22 Mar 2012 at 4:39

GoogleCodeExporter commented 8 years ago

Original comment by msgilli...@gmail.com on 22 Mar 2012 at 4:40

GoogleCodeExporter commented 8 years ago
Issue 190 has been merged into this issue.

Original comment by msgilli...@gmail.com on 3 Apr 2012 at 10:07

GoogleCodeExporter commented 8 years ago
-1

I'd rather stay with an attribute, why not "data-selected“ to match W3C 
recommendation and stay future-proof ?
+ first screen to be used if no data-selected set

http://code.google.com/r/remigrumeau-iui-dev/source/detail?r=263299eb4c9f97ada41
c43a5602e4c77ed4ce749&name=no_selected_attribute

Original comment by remi.gru...@gmail.com on 10 May 2012 at 9:31

GoogleCodeExporter commented 8 years ago
Well, the change in comment #2 encapsulates the behavior in two functions.  
That way it is easy to change the name of the attribute that is used or whether 
it is an attribute at all.  That's the important change.  Whether it is a CSS 
class or 'shown' or 'selected' or 'data-selected' or 'data-iui-selected' you 
just have to change the code inside two functions.

Original comment by msgilli...@gmail.com on 10 May 2012 at 9:55