Tham khảo tài liệu 'creating applications with mozilla-chapter 7. extending the ui with xbl- p2', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Chapter 7. Extending the UI with XBL- P2 The code you see here is not necessary in this binding but it shows you the format for executing code in the destructor. Destructors are great to use when you have loaded a component in the binding and want to set the variable representing the component to null to avoid memory leaks. If you have a lot of bindings that load and then unload components while a Mozilla session is still running a significant amount of memory can be eaten up unless you take this kind of step. . Properties Like Java properties an XBL property has getters and setters so they can behave differently when you read or write data. Here is a subset of properties used in this binding property name value readonly true getter return getter property property name uppercase readonly true onget return property name backgroundColor getter return getter setter val return val setter property At this point the characteristics of properties to watch out for include the readonly attribute the getter and setter elements and the existence of a val keyword that is used internally for accessing a property s current value. For your reference this binding s property extracts are used for getting the value of the input field returning an uppercase version of the inputted text and getting or setting the input field s background color. . Methods Methods in XBL are self-contained functions represented by the method tag and encapsulated within the implementation element. They usually provide a binding object with a specific function like copying and saving some data or showing and hiding widget controls. Like properties they can be called from within the binding from another binding that subclasses that binding and directly from the bound element. method name clear body body method method name setValue parameter name .