/src/cocktail/domElement/js/TextDOMElement.hx

http://github.com/silexlabs/Cocktail · Haxe · 48 lines · 18 code · 3 blank · 27 comment · 0 complexity · c273f5cd0b79ab5a5f84435a03075fe4 MD5 · raw file

  1. /*
  2. This file is part of Silex - see http://projects.silexlabs.org/?/silex
  3. Silex is Š 2010-2011 Silex Labs and is released under the GPL License:
  4. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License (GPL) as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
  5. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  6. To read the license please visit http://www.gnu.org/copyleft/gpl.html
  7. */
  8. package cocktail.domElement.js;
  9. import cocktail.nativeElement.NativeElement;
  10. import js.Dom;
  11. import js.Lib;
  12. import cocktail.domElement.abstract.AbstractTextDOMElement;
  13. /**
  14. * This is the JavaScript implementation for the Text DOMElement
  15. *
  16. * It adds the JavaScript specific behaviour of setting the HTML
  17. * of the reference to native DOM object
  18. *
  19. * @author Yannick DOMINGUEZ
  20. */
  21. class TextDOMElement extends AbstractTextDOMElement
  22. {
  23. /**
  24. * class constructor
  25. */
  26. public function new(nativeElement:NativeElement = null)
  27. {
  28. super(nativeElement);
  29. }
  30. /**
  31. * Set the innerHTML of the reference to the native
  32. * HTML tag with the provided text
  33. * @param text an HTML formatted text
  34. */
  35. override public function setText(text:String):String
  36. {
  37. super.setText(text);
  38. this._nativeElement.innerHTML = text;
  39. return text;
  40. }
  41. }