placeholder.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. (function() {
  2. var Placeholder, Selector,
  3. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  4. hasProp = {}.hasOwnProperty;
  5. Selector = require('../selector');
  6. Placeholder = (function(superClass) {
  7. extend(Placeholder, superClass);
  8. function Placeholder() {
  9. return Placeholder.__super__.constructor.apply(this, arguments);
  10. }
  11. Placeholder.names = [':placeholder-shown', '::placeholder'];
  12. Placeholder.prototype.possible = function() {
  13. return Placeholder.__super__.possible.apply(this, arguments).concat('-moz- old');
  14. };
  15. Placeholder.prototype.prefixed = function(prefix) {
  16. if ('-webkit-' === prefix) {
  17. return '::-webkit-input-placeholder';
  18. } else if ('-ms-' === prefix) {
  19. return ':-ms-input-placeholder';
  20. } else if ('-moz- old' === prefix) {
  21. return ':-moz-placeholder';
  22. } else {
  23. return "::" + prefix + "placeholder";
  24. }
  25. };
  26. return Placeholder;
  27. })(Selector);
  28. module.exports = Placeholder;
  29. }).call(this);