Closed Bug 902215 Opened 12 years ago Closed 7 years ago

[meta] Refactor HTMLInputElement using the strategy pattern

Categories

(Core :: DOM: Core & HTML, defect, P2)

defect

Tracking

()

RESOLVED FIXED

People

(Reporter: jwatt, Unassigned)

References

Details

(Keywords: meta)

The code in HTMLInputElement.cpp is pretty horrible and a lot harder to work with than it should be. We should break up HTMLInputElement using the strategy pattern: http://en.wikipedia.org/wiki/Strategy_pattern Each input type should have its own "strategy" implementation in it its own separate file. For example, HTMLInputElementTypeFile would be for type="file", stored in HTMLInputElementTypeFile.{h|cpp}.
I'm thinking using the strategy pattern together with the factory method. That is, |HTMLInputElement| stays as it is now, but it "has a" |InputType|, which is the base class for each of the input types, e.g. |NumberInputType|, |RadioInputType|, |DateInputType|, etc. Of course, we can add more level of inheritance if needed, for example, |InputType| <- |DateTimeInputType| <- |DateInputType|. And then we use the factory method to instantiate the correct |InputType|. We can discuss more about it during the Hawaii All Hands. Any suggestions are welcome!
sounds all good. I guess one can start splitting functionality to "InputType" one by one, like first validation related stuff, then event handling, then something else... whichever order makes most sense.
Summary: Refactor HTMLInputElement using the strategy pattern → [meta] Refactor HTMLInputElement using the strategy pattern
Priority: -- → P2
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.