[Cosmo-dev] Fwd: dojo.provide in styler
travis at osafoundation.org
Wed Nov 29 12:03:55 PST 2006
What started as a JS question has turned into a discussion that
Matthew and I thought should be on the list. If folks interested in
how we're using Dojo and the overall organization of our client side
UI code could read down, I'm going to post my next e-mail (containing
a proposal) as a reply to this.
Begin forwarded message:
> From: Matthew Eernisse <mde at osafoundation.org>
> Date: November 28, 2006 8:46:31 PM PST
> To: Travis Vachon <travis at osafoundation.org>
> Subject: Re: dojo.provide in styler
> Actually, I just made some changes to the Styler code as a result
> beta-testing the new Firebug 1.0. The beta actually has a couple of
> bugs that lead me to fix some some in there, woohoo! :)
> I think doing that stuff with Dojo requires will be problematic
> because in Safari all the dynamic CSS is being done with the ugly
> document.write hack -- Safari only gives you read-access via DOM
> methods to the doc's stylesheets. That's why that script include
> sits where it does on the page -- in Safari it gets written out as
> an inline style. The code that does the document.write of course
> can be defined anywhere -- but it needs to be called, inline, at
> that point as the page is loading.
> The global.css.js file may be the one place we will have to
> continue using old-skool script includes -- ui.conf.js is just a
> bunch of config settings, so it may not matter for those, as long
> as the constants are available to the scripts that need them, when
> they need them.
> The one thing we do need to do with global.css.js though is
> rewriting it to use OOP. It's the one place I can think of in the
> system I had to hack in in a hurry ("Oh, shit, it doesn't work in
> Safari," I believe was the urgency), so it's just out there as a
> nasty global function.
> Very good that you asked instead of just diving in and doing it. :)
> Travis Vachon wrote:
>> Hi Matthew
>> I'm working on the JS for account activation, and wanted to run a
>> change I've made by you before I go any further.
>> To make styler work with dojo.require, I needed to make
>> global.css.js and ui.conf.js work with dojo.require. This meant
>> adding the appropriate dojo.provide statement inside of each.
>> Unfortunately, because of the "." in each of their names, dojo
>> gets confused. To fix this, I've renamed them to globalcss.js and
>> uiconf.js, and added "dojo.provide("cosmo.ui.globalcss");" and
>> "dojo.provide("cosmo.ui.uiconf");" in the appropriate spots.
>> The nice thing about all of this is that we can remove the inline
>> ("cosmo.ui.globalcss")" in the JS file of any widgets we want to
>> respect the global css configuration.
>> Is there any reason not to go this route? If you think all of this
>> is ok, I'll update the necessary JSPs before I commit (including
>> Let me know what you think!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cosmo-dev