Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

135
Vistas
Retrieve getter and setter of 'value' property of 'textarea' in older browsers

I am having some trouble retrieving the getter and setter of a textarea's value property in older browsers, such as Firefox 4 and Chromium 30.

In a nutshell, I am trying to run some code each time a textarea's value is updated programatically, by someone else, like so:

textarea.value="some value";

According to information like https://stackoverflow.com/a/58585971 and https://stackoverflow.com/a/55033939, the only reliable way seems to be this: define new getter and setter for the textarea's value property, with the setter containing the custom code. But, before that, retrieve the original getter and setter and re-purpose them so that the original functionality is preserved.

I am retrieving the descriptor (which contains the getter and setter) like so:

var desc=Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype,"value");

or

desc=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(textarea),"value");

or

desc=Object.getOwnPropertyDescriptor(textarea.constructor.prototype,"value");  /* Risky */

or

desc=Object.getOwnPropertyDescriptor(textarea.__proto__,"value");  /* Obsolete */

All of these are retrieving the value descriptor perfectly in any modern browser, including Internet Explorer, but not in older browsers, such as Firefox 4 and Chromium 30 (even though they support all of the above properties and methods). They are returning undefined. In those, HTMLTextAreaElement.prototype does not have a value property, and yet the actual textarea's got them!

How did those browsers implement the value property, if not with getter and setter? Or, how to retrieve them?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda