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

Problem with skins and YUILoader (was: Editor Requests Invalid CSS)

Expand Messages
  • MikeHatfield
    I m also seeing this same behaviour where undefined appears in css requests from the YUILoader. I ve traced it to the _config() function. The problem is that
    Message 1 of 4 , Apr 30 9:46 AM
    • 0 Attachment
      I'm also seeing this same behaviour where "undefined" appears in css requests from the
      YUILoader.

      I've traced it to the _config() function. The problem is that the default this.skin object gets
      completely overwritten with that passed-in to the YUILoader constructor. This in turn
      means expected properties are undefined unless explicitly passed-in via the skin{} object.

      A patch which seems to work is as follows:

      _config: function(o) {

      // apply config values
      if (o) {
      for (var i in o) {
      if (lang.hasOwnProperty(o, i)) {
      if (i == "require") {
      this.require(o[i]);
      } else if (typeof o[i] == "object") {
      this[i] = lang.merge(this[i], o[i]);
      } else {
      this[i] = o[i];
      }
      }
      }
      }

      Notice the extra typeof check and call to merge in this case.

      I'll raise this in SF too...

      Regards,
      Mike

      --- In ydn-javascript@yahoogroups.com, "strycken_1" <anything@...> wrote:
      >
      > Thanks a lot! That worked perfectly. I must admit to having no idea
      > why, however--that was suggested in the online documentation.
      >
      > --Wesley
      >
      > --- In ydn-javascript@yahoogroups.com, "Satyam" <satyam@> wrote:
      > >
      > > I've seen no better answer so let me try my guess:
      > >
      > > Delete that line that says skin:{defaultSkin:'sam'}.
      > >
      > > Satyam
      > >
      > >
      > >
      > > ----- Original Message -----
      > > From: "strycken_1" <anything@>
      > > To: <ydn-javascript@yahoogroups.com>
      > > Sent: Monday, March 17, 2008 9:50 PM
      > > Subject: [ydn-javascript] Editor Requests Invalid CSS
      > >
      > >
      > > >I recently downloaded version 2.5.0 of the YUI Library for a website
      > > > I'm building, and have been trying to get the Editor working. I'm
      > > > using the Loader class to load the editor, which works fine--however,
      > > > the editor toolbar is showing up horribly mutilated, and upon viewing
      > > > the requests list in Firebug, three CSS files were being marked with
      > > > 404 errors.
      > > >
      > > > The URLs of these three files are:
      > > > http://yui.yahooapis.com/2.5.0/build/editor/undefinedsam/editor.css
      > > > http://yui.yahooapis.com/2.5.0/build/menu/undefinedsam/menu.css
      > > > http://yui.yahooapis.com/2.5.0/build/button/undefinedsam/button.css
      > > >
      > > > I'm relatively new to the YUI library, but I'm assuming that the
      > > > "undefined" in the URL is not a good thing.
      > > >
      > > > Here's the code I'm using:
      > > >
      > > > <script type="text/javascript"
      > > >
      > src="http://yui.yahooapis.com/2.5.0/build/yuiloader/yuiloader-beta-
      min.js"></script>
      > > >
      > > > <script>
      > > > var loader = new YAHOO.util.YUILoader({
      > > >
      > > > require: ["editor"],
      > > >
      > > > skin: { defaultSkin: 'sam' },
      > > >
      > > > loadOptional: true,
      > > >
      > > > onSuccess: function() {
      > > > var myConfig = {
      > > > height: '300px',
      > > > width: '530px',
      > > > dompath: true,
      > > > focusAtStart: true
      > > > };
      > > >
      > > > var myEditor = new YAHOO.widget.Editor('contentEditor', myConfig);
      > > > myEditor.render();
      > > > }
      > > > });
      > > >
      > > > loader.insert();
      > > >
      > > > </script>
      > > >
      > > > Can anyone identify what's going wrong here?
      > > >
      > > >
      > > > ------------------------------------
      > > >
      > > > Yahoo! Groups Links
      > > >
      > > >
      > > >
      > > >
      > > >
      > > > --
      > > > No virus found in this incoming message.
      > > > Checked by AVG.
      > > > Version: 7.5.519 / Virus Database: 269.21.7/1331 - Release Date:
      > > > 16/03/2008 10:34
      > > >
      > > >
      > >
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.