Re: [whatwg] Detecting Web Forms for future proof scripts?

2008-10-23 Thread Ian Hickson
On Mon, 2 Oct 2006, Ric Hardacre wrote:

 [scriplets] need to check that they're running on a compatible scripting 
 engine, just checking for the existence of document.getElementById is 
 the simple way (If there are better ways then I'm always open to 
 learning). But I'm presented with an issue, suppose for example I wanted 
 to emulate the datalist element for a text box. I can use the DOM and 
 some on-the fly CSS to build a Javascript emulated datalist, but how 
 would one go about ensuring that if/when it encounters a browser that 
 can handle the datalist that it does not execute? This is probably quite 
 an open question and yes I'm aware of the 
 embedding-a-select-inside-the-datalist solution to this particular 
 example, but the general question remains: How to script WF2 
 functionality for current browsers in a way that both degrades AND 
 yields to the UA when it can handle the functionality natively?

For datalist, you could just check the class name of a datalist 
element, or check to see if the input element has a list DOM 
attribute, as in if ('list' in inputElement).

Cheers,
-- 
Ian Hickson   U+1047E)\._.,--,'``.fL
http://ln.hixie.ch/   U+263A/,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'


[whatwg] Detecting Web Forms for future proof scripts?

2006-10-02 Thread Ric Hardacre
I'm attempting to write Javascript scriptlets to emulate some of the Web
Forms 2.0 spec in HTML 4 documents. Firstly, they obviously need to
degrade for non-scripting UAs, which is easy enough. Secondly they need
to check that they're running on a compatible scripting engine, just
checking for the existence of document.getElementById is the simple way
(If there are better ways then I'm always open to learning). But I'm
presented with an issue, suppose for example I wanted to emulate the
datalist element for a text box. I can use the DOM and some on-the fly
CSS to build a Javascript emulated datalist, but how would one go about
ensuring that if/when it encounters a browser that can handle the
datalist that it does not execute? This is probably quite an open
question and yes I'm aware of the embedding-a-select-inside-the-datalist
solution to this particular example, but the general question remains:
How to script WF2 functionality for current browsers in a way that both
degrades AND yields to the UA when it can handle the functionality natively?

Ric Hardacre
http://www.cyclomedia.co.uk/


Re: [whatwg] Detecting Web Forms for future proof scripts?

2006-10-02 Thread Shawn Wilsher

Ric,

Hopefully, you aren't duplicating work that has already been done here:
https://sourceforge.net/projects/wf2/

Granted, this is only for IE, but nearly half of your work is already done then.

Cheers,

Shawn

On 10/2/06, Ric Hardacre [EMAIL PROTECTED] wrote:

I'm attempting to write Javascript scriptlets to emulate some of the Web
Forms 2.0 spec in HTML 4 documents. Firstly, they obviously need to
degrade for non-scripting UAs, which is easy enough. Secondly they need
to check that they're running on a compatible scripting engine, just
checking for the existence of document.getElementById is the simple way
(If there are better ways then I'm always open to learning). But I'm
presented with an issue, suppose for example I wanted to emulate the
datalist element for a text box. I can use the DOM and some on-the fly
CSS to build a Javascript emulated datalist, but how would one go about
ensuring that if/when it encounters a browser that can handle the
datalist that it does not execute? This is probably quite an open
question and yes I'm aware of the embedding-a-select-inside-the-datalist
solution to this particular example, but the general question remains:
How to script WF2 functionality for current browsers in a way that both
degrades AND yields to the UA when it can handle the functionality natively?

Ric Hardacre
http://www.cyclomedia.co.uk/



Re: [whatwg] Detecting Web Forms for future proof scripts?

2006-10-02 Thread Shawn Wilsher

This project appears to be dead for over a year now. It seems to have at
least intention to support Gecko, but I couldn't get it to work properly
in Firefox.


Just because the project appears to be dead doesn't mean you should
just disregard all the work that has been done with it before.  It's
original aim is only for IE (as stated in the description).  However,
it has a large amount of work already done - why reinvent the wheel?

Cheers,

Shawn


Re: [whatwg] Detecting Web Forms for future proof scripts?

2006-10-02 Thread Kornel Lesinski
On Mon, 02 Oct 2006 17:00:02 +0100, Shawn Wilsher [EMAIL PROTECTED]  
wrote:



Hopefully, you aren't duplicating work that has already been done here:
https://sourceforge.net/projects/wf2/

Granted, this is only for IE, but nearly half of your work is already  
done then.


This project appears to be dead for over a year now. It seems to have at  
least intention to support Gecko, but I couldn't get it to work properly  
in Firefox.



I've ran into similar problem as the original poster. For inputs, buttons  
and repetition there's an easy solution:


input.setAttribute('type','uri');
if (input.type != 'uri') alert('no native WF2!');

but it's a stretch to assume that support of certain input type means  
support for all of WF2, so I'm curious how can one detect support for  
other functionality.


--
pozdrawiam, Kornel Lesiński


Re: [whatwg] Detecting Web Forms for future proof scripts?

2006-10-02 Thread Kornel Lesinski
On Mon, 02 Oct 2006 17:37:28 +0100, Shawn Wilsher [EMAIL PROTECTED]  
wrote:



This project appears to be dead for over a year now. It seems to have at
least intention to support Gecko, but I couldn't get it to work properly
in Firefox.


Just because the project appears to be dead doesn't mean you should
just disregard all the work that has been done with it before.  It's
original aim is only for IE (as stated in the description).  However,
it has a large amount of work already done - why reinvent the wheel?


If I need just a feature or two, it's easier for me to write and maintain  
my own bit of code rather than rip it out of an unfinished, unstable code  
that I'm not familiar with.


I'd love to use that script once it's production-ready.

--
regards, Kornel Lesiński


Re: [whatwg] Detecting Web Forms for future proof scripts?

2006-10-02 Thread Dean Edwards

Kornel Lesinski wrote:
On Mon, 02 Oct 2006 17:37:28 +0100, Shawn Wilsher [EMAIL PROTECTED] 
wrote:



This project appears to be dead for over a year now. It seems to have at
least intention to support Gecko, but I couldn't get it to work properly
in Firefox.


Just because the project appears to be dead doesn't mean you should
just disregard all the work that has been done with it before.  It's
original aim is only for IE (as stated in the description).  However,
it has a large amount of work already done - why reinvent the wheel?


If I need just a feature or two, it's easier for me to write and 
maintain my own bit of code rather than rip it out of an unfinished, 
unstable code that I'm not familiar with.


I'd love to use that script once it's production-ready.



The project isn't dead. We stopped developing it as Mozilla had not 
started on WF2. That has now changed [1] and we will soon restart 
development.


There is no intention to support Gecko, it is an IE only implementation.

Although it is not production ready, it is pretty close. By all means 
download and play with it. Let me know if you find any bugs!


-dean

[1] https://bugzilla.mozilla.org/show_bug.cgi?id=344614


Re: [whatwg] Detecting Web Forms for future proof scripts?

2006-10-02 Thread Hallvord R M Steen

[Sorry Ric, re-sending to include the list]

On 02/10/06, Ric Hardacre [EMAIL PROTECTED] wrote:

 suppose for example I wanted to emulate the
datalist element for a text box. I can use the DOM and some on-the fly
CSS to build a Javascript emulated datalist, but how would one go about
ensuring that if/when it encounters a browser that can handle the
datalist that it does not execute?


What about this attempt?

http://www.hallvord.com/opera/demo/wf2-datalist.htm

--
Hallvord R. M. Steen