pChart 2.x forum http://wiki.pchart.net/forum/ |
|
Delayed rendering request http://wiki.pchart.net/forum/viewtopic.php?f=3&t=12 |
Page 1 of 1 |
Author: | mathbr [ Thu Dec 09, 2010 5:41 pm ] |
Post subject: | Delayed rendering request |
Hello I would like to suggest a change in the delayed function, in order for it to be available on non-javascript browsers and search engine. Right now, the image url is not directly in the page so diagrams are inaccessible for both cases. What I propose is to replace the div tag by a link one. The href attribute points to the image, and the content of the a tag can be the alternative text, like on the following example: Code: <a class="pChart" href="draw.php?Seed=2" >my image legend</a> The script would replace it by a div with the loading image at initialization (data attribute are prefixed with pchart not to hurt other library) Code: <div data-pchart-url="draw.php?Seed=2" data-pchart-alt="my image legend" ><!-- generated html --></div> And it would finally load it when actually required Code: <div class="pChart"><img src="draw.php?Seed=2" alt="my image legend" /></div> It would even be easy for a user to template that, for example to add a span containing the legend under the image. If the user wants to add properties to that like classes/ids, he can add a div wrapper around the original a, that will be preserved by pChart. However that means that no html is accepted in the a tag, that could be a problem solved by saying that the alternative text is stored in a data attribute (data-pchart-alt) and that the content is just deleted. In case you don‘t want that, would it be possible to at least replace the use of formatted id attribute by using a normal id and a data attribute? In my opinion it would more respect the semantics. [you can delete my comment on the documentation website, I just discovered this forum that is a better place for that] Mathieu |
Author: | jean-damien [ Fri Dec 10, 2010 9:56 am ] |
Post subject: | Re: Delayed rendering request |
Hi really like this idea and indeed non-js capable browser will be able to keep a link to the pictures. I've replaced the old div syntax by : Code: <a class='pChart' href='draw.php?Seed=1' alt='Picture1' data-width='700' data-height='230'>Picture 1</a> The alt, width and height tags are optional but can help to keep a reliable page layout. Change already applied in the 2.06 and working on internet explorer & firefox. Thank you ;o) JD. |
Author: | mathbr [ Fri Dec 10, 2010 11:45 am ] |
Post subject: | Re: Delayed rendering request |
Nice and fast! Thank you for that. The last issue I see is that the alt attribute is not allowed in <a> tags, so pages cannot be valid html. I don't see any valid attribute that could handle that, so in my opinion it should be replaced by one data- attribute. And I would recommend (but this is not required) to prefix data attributes like data-pchart-width (W3C recommends lowercase attributes but this is not a requirement, so data-pChart-width is acceptable too) so that if another library wants to use data attributes with the same name on this element, there will not be any conflict. |
Author: | jean-damien [ Fri Dec 10, 2010 12:19 pm ] |
Post subject: | Re: Delayed rendering request |
Again appreciated comments! I've modified the code accordingly : Code: <a class=‘pChart‘ href=‘draw.php?Seed=1‘ data-pchart-alt=‘Picture1‘ data-pchart-width=‘700‘ data-pchart-height=‘230‘>Picture 1</a> I'll release the 2.0.6 in the afternoon. |
Author: | jean-damien [ Fri Dec 10, 2010 5:26 pm ] |
Post subject: | Re: Delayed rendering request |
Here we are, 2.0.6 is out. |
Page 1 of 1 | All times are UTC |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |