[thelist] How to style a widget?

Hassan Schroeder hassan.schroeder at gmail.com
Wed Jun 17 20:25:28 CDT 2009

On Wed, Jun 17, 2009 at 12:15 PM, Jay Turley <jayturley at gmail.com> wrote:

> The widget is loaded using the following code:
>  <script type="text/javascript">
>     document.write(unescape("%3Cscript src='[widget_url]'
> type='text/javascript'%3E%3C/script%3E"));
>  </script>

OK, one of those days, and I probably shouldn't go there, but -- WTF?

Why are you using a script tag to *write* a script tag into the page??
When the tag is just a `src=` vehicle???

> As far as I know, <style> and <link> tags must appear in the <head> section.
> This pretty much means that either:
> (1) All styling must be inline, or
> (2) I must ask for users of the widget to add the CSS using <style> or
> <link> - making it more difficult to place.

Or use the DOM -- yes, I think document.write is an abomination --
to add your style section to the document head.

Though in the case of a widget, assigning styles via JS seems like
not a bad idea, since a style written into the document might conflict
with other existing styles.

Hassan Schroeder ------------------------ hassan.schroeder at gmail.com

More information about the thelist mailing list