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)
Core
DOM: Core & HTML
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}.
Comment 1•9 years ago
|
||
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!
Comment 2•9 years ago
|
||
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.
Updated•9 years ago
|
Summary: Refactor HTMLInputElement using the strategy pattern → [meta] Refactor HTMLInputElement using the strategy pattern
Updated•8 years ago
|
Priority: -- → P2
Comment 3•7 years ago
|
||
Jessica basically fixed this in bug 1345767
https://searchfox.org/mozilla-central/rev/876022232b15425bb9efde189caf747823b39567/dom/html/input/InputType.h#34-37
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.
Description
•