On Saturday, October 26, 2013 10:49:22 PM UTC-4, Anton Aylward wrote:

> Scott Simmons said the following on 10/26/2013 09:49 PM: 
> > Consider what happens if you have a standard, non-fancy HTML page with 
> > two external stylesheets referenced in the source.  You open that page 
> > in the browser, and the browser reads the code to display the page, 
> > building a working version (a DOM) out of what it encounters.  It loads 
> > the first external stylesheet into memory, then the second.  If a class 
> > in the second stylesheet contradicts the first, it supersedes it — but 
> > the browser doesn't write those changes back to the HTML file. 
>
> Yes, but the moment you introduce javascript everything changes and the 
> above assertion isn't true any more.  In fact its irrelevant. 
>

You misunderstand me.  The above isn't a literal depiction of anything that 
happens when you load TiddlyWiki.  It's an analogy to explain how 
TiddlyWiki creates its DOM as the page loads.  Just as classes in CSS 
supersede each other as the CSS files cascade, classes from different 
tiddlers (shadows, StyleSheet, plugins) supersede each other to built a 
single library of styles used by the TW.

On Saturday, October 26, 2013 9:47:57 PM UTC-4, Anton Aylward wrote:
>
>
> Again, something is not right. 
> The way you've worded that it seems that the dynamic system reads the 
> shadow tiddlers then adds internally the css from the user defined 
> StyleSheet tiddler and then adds 'invisibly' the plugin styles.
>

That's the correct order.
 

> That means that the plugin styles overrides the styles in SytleSheet. 
> Which seems backwards to me
>

Also correct.

A mischievous plugin could indeed change your text color or the position of 
your tiddlers — but most only define/add styles specific to the elements 
they're creating.  FootnotesPlugin and AnnotationsPlugin, for example, 
contain CSS that define the footnotes and annotations they create but don't 
affect the rest of the TW.
 

> You also seem to be saying that the system reads the other shadow 
> StyleSheet tiddlers rather than generating them.  Which is it? 
>
> Are you saying that 
>
>   FOR-EACH-OF("StyleSheetColors","StyleSheetLayout","StyleSheetLocale", 
>               "StyleSheetPrint", "StyleSheetLocale") => i 
>
>         IF NOT EXIST(i) THEN /* tiddler doens't exist, remake it */ 
>                 maketiddler( regenerate-from-core(i), i ) 
>          ELSEIF  regenerate-from-core(i) != i 
>                  replace-core-with(i) 
>          ELSEIF  /* tiddler is the same as core, unchaged, leave it */ 
>                  NULL /* do nothing */ 
>          END-IF 
> END-FOR 
>
> Horrible pseudocode, but I can't see any other wy of trying to 
> disambiguate what you're saying.  Because I think you're contradicting 
> yourself. 
>

It does the trick!  ;)  It's hard to communicate the differences since 
we're thinking of the process so differently; it's difficult to step inside 
someone else's paradigm and then step back to your own.

The shadow tiddlers are hard-coded into the core and serve as fallbacks. 
 If you've created a tiddler named "StyleSheetColors," that's the one that 
will be loaded and used.  If you haven't, the shadow tiddler 
StyleSheetColors will be used.  (Either way, one or the other will be 
looked at as the DOM is built.)
 

> As far as I can see the whole point of the StyleSheet tiddler is to 
> over-ride anything else.  Thus it has to come last.  It may import other 
> stylesheets such as Erics "StyleSheetShortcuts".  If I import at the 
> beginning of the StyleSheet then I can override some of Eric's 
> adjustments :-)  If I import at the end then I can't. 
>
> ORDER MATTERS! 
>

Absolutely.  But there are two elements to our discussion:  Which order CSS 
elements ARE processed in and which order they SHOULD BE processed in.

On Saturday, October 26, 2013 11:13:39 PM UTC-4, Arc Acorn wrote:
>
> Just as an FYI for order of how things go: 
>
> setStylesheet() Function is done when the plugins load which means these 
> styles should be loaded very early on before any stylesheets, and if 
> plugins had conflicting rules the one loaded lower would win AKA: zzPlugin 
> would override yyPlugin 
>
> eg your cascading chain.
> setStylesheet() 0-z -> Shadow StyleSheets 0-z? -> User StyleSheet('s) (in 
> order they are linked) ->Element styles
>

As I understand it, styles added by setStylesheet() are appended AFTER user 
StyleSheet(s) but cannot supersede styles that were loaded into the DOM 
earlier.  It's the one place where a class defined in zzPlugin would NOT 
override the same class set in yyPlugin.  This means a plugin can define 
classes using setStylesheet() in case they don't exist in a given 
TiddlyWiki but still be assured of not superseding a class of the same name 
in the user's StyleSheet.

That seems a bit counterintuitive, and it's been a while since I 
encountered such case — so I cooked up a demo to make sure that's how it 
works:

http://tiddlywiki.secret-hq.com/CSSLoadOrderDemo.html

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to