Loading ...
Sorry, an error occurred while loading the content.

Re: Get Utility and Print Stylesheets

Expand Messages
  • foxxtrot713
    ... Okay, so, I went ahead and did the other potential implementation, which I think might be a bit better. Test is: http://catalog.wsu.edu/css_test3.html Code
    Message 1 of 3 , Aug 28, 2008
    • 0 Attachment
      --- In ydn-javascript@yahoogroups.com, "foxxtrot713" <foxxtrot@> wrote:
      > I am currently working on implementing this, but I wanted to see what
      > anyone else might have to say about this.  Also, has anyone else
      > noticed such behavior on other browsers?
      >
      > I have put together a simple example of this at:
      > http://catalog.wsu.edu/css_test.html

      Okay, so, I went ahead and did the other potential implementation, which I think might be a bit better.

      Test is:
      http://catalog.wsu.edu/css_test3.html

      Code is:
      http://catalog.wsu.edu/Content/get-debug-otherchanges.js

      Diff is:
      --- get-debug.js	2008-06-18 08:18:27.939931500 -0700
      +++ get-debug-otherchanges.js	2008-08-28 12:41:30.457239000 -0700
      @@ -87,15 +87,16 @@
            * @return {HTMLElement} the generated node
            * @private
            */
      -    var _linkNode = function(url, win, charset) {
      +    var _linkNode = function(url, win, charset, attrs) {
               var c = charset || "utf-8";
      -        return _node("link", {
      +        var a = attrs || { };
      +        return _node("link", lang.merge({
                       "id":      "yui__dyn_" + (nidx++),
                       "type":    "text/css",
                       "charset": c,
                       "rel":     "stylesheet",
                       "href":    url
      -            }, win);
      +            }, a), win);
           };
       
           /**
      @@ -106,14 +107,15 @@
            * @return {HTMLElement} the generated node
            * @private
            */
      -    var _scriptNode = function(url, win, charset) {
      +    var _scriptNode = function(url, win, charset, attrs) {
               var c = charset || "utf-8";
      -        return _node("script", {
      +        var a = attrs || { };
      +        return _node("script", lang.merge({
                       "id":      "yui__dyn_" + (nidx++),
                       "type":    "text/javascript",
                       "charset": c,
                       "src":     url
      -            }, win);
      +            }, a), win);
           };
       
           /**
      @@ -248,9 +250,9 @@
               YAHOO.log("attempting to load " + url, "info", "Get");
       
               if (q.type === "script") {
      -            n = _scriptNode(url, w, q.charset);
      +            n = _scriptNode(url, w, q.charset, q.attributes);
               } else {
      -            n = _linkNode(url, w, q.charset);
      +            n = _linkNode(url, w, q.charset, q.attributes);
               }
       
               // track this node's load progress
      
      
      This diff is shorter, and the way it's used is cleaner.

      Jeff Craig
    Your message has been successfully submitted and would be delivered to recipients shortly.