LinkPane.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. Copyright (c) 2004-2012, The Dojo Foundation All Rights Reserved.
  3. Available via Academic Free License >= 2.1 OR the modified BSD license.
  4. see: http://dojotoolkit.org/license for details
  5. */
  6. if(!dojo._hasResource["dijit.layout.LinkPane"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
  7. dojo._hasResource["dijit.layout.LinkPane"] = true;
  8. dojo.provide("dijit.layout.LinkPane");
  9. dojo.require("dijit.layout.ContentPane");
  10. dojo.require("dijit._Templated");
  11. dojo.declare("dijit.layout.LinkPane",
  12. [dijit.layout.ContentPane, dijit._Templated],
  13. {
  14. // summary:
  15. // A ContentPane with an href where (when declared in markup)
  16. // the title is specified as innerHTML rather than as a title attribute.
  17. // description:
  18. // LinkPane is just a ContentPane that is declared in markup similarly
  19. // to an anchor. The anchor's body (the words between `<a>` and `</a>`)
  20. // become the title of the widget (used for TabContainer, AccordionContainer, etc.)
  21. // example:
  22. // | <a href="foo.html">my title</a>
  23. // I'm using a template because the user may specify the input as
  24. // <a href="foo.html">title</a>, in which case we need to get rid of the
  25. // <a> because we don't want a link.
  26. templateString: '<div class="dijitLinkPane" dojoAttachPoint="containerNode"></div>',
  27. postMixInProperties: function(){
  28. // If user has specified node contents, they become the title
  29. // (the link must be plain text)
  30. if(this.srcNodeRef){
  31. this.title += this.srcNodeRef.innerHTML;
  32. }
  33. this.inherited(arguments);
  34. },
  35. _fillContent: function(/*DomNode*/ source){
  36. // Overrides _Templated._fillContent().
  37. // _Templated._fillContent() relocates srcNodeRef innerHTML to templated container node,
  38. // but in our case the srcNodeRef innerHTML is the title, so shouldn't be
  39. // copied
  40. }
  41. });
  42. }