Jerome Velociter wrote:
On 11/12/09 1:25 PM, Marius Dumitru Florea wrote:
Hi Jerome,
Jerome Velociter wrote:
Hello all,
I think it would be nice to have the possibility to post-load some of
the JavaScript extensions, as a way to ease performance best practices
for developers. (See
http://developer.yahoo.com/performance/rules.html#postload for example).
It would also allow people to easily add hungry third party scripts
(like the google analytics tracker) in a non intrusive manner and not
sacrificing performance (no need to modify/override htmlfooter.vm for
example, a simple SX always-use will do).
I see different ways of doing that :
1) Either we say all document JSX are post-loaded, and we move the hook
down the DOM just before the closing</body> tag.
This poses a problem in
WYSIWYG editing mode. I'm currently loading the
JSX in edit mode in order for the page to look as in view mode. Placing
the hook inside the editable body is dangerous.
In the case of the WYSIWYG we could keep it in the header (I believe you
already are placing the hook yourself and do not use javascript.vm,
right ?).
I'm including the javascript.vm and thus I inherit the hook position (as
long as the position is in the head of course).
Now, wouldn't be better to write a JSX post-onload downloader? It should
be small enough to be placed in the head and it will fetch all the
deferrable JSX after the DOM is ready. I understand that some JS
frameworks already support this. WDYT?
BTW is it such a good idea to load extensions in edit mode?
I'm not very convinced, since some extensions could affect the content
of the edited DOM, leading to weird content. (Think about the addSizes
extension of the SX tutorial for example
http://platform.xwiki.org/xwiki/bin/view/DevGuide/SkinExtensionsTutorial).
There were some complains regarding the fact that the live table doesn't
look the same in edit mode so I had to load the extensions in edit mode
(
http://jira.xwiki.org/jira/browse/XWIKI-3991 ). This is just an
example. Once we have transformation markers any JSX will be able to
change the DOM provided the changes are marked. Also, I'm thinking that
a macro could use a JSX to "draw" something on the page. If JSX are not
loaded in edit mode the page will look different.
Marius
Jerome.
Marius
2) Either we have 2 hooks and we leave it as an
option to be post-loaded.
My preference goes to 1), as I don't see any good use case where a
extension would need not to be post-loaded; and 2) is not so elegant to
implement with the current SX mecanism.
WDYT ?
(Note: I'm not talking about file-system extensions here (JSFX), though
the question could be asked for them as well - I need to give it more
thoughts)
Jerome.
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs