(Google Groups didn't post my message here to the group, so re-posting it here)
Hello Abed,
Correct. For a custom constraint, theoretically a developer could do whatever he/she wanted, because he/she provides the validator. However, allowing custom constraints to be attached to non-input and non-form elements would create a difference in the way default and custom constraints behave. One of the hallmarks of a good API is orthogonality; making custom constraints work on non-form and non-input elements would violate that principle. It also violates the "principle of least surprise". Secondly, adding that sort of functionality to custom constraints also creates inconsistencies in the behavior between default and custom constraints, which is extremely undesirable in an API.
Another reason is the 80/20 rule. 80% of the users use 20% of the features. Most people are not going to want to attach constraints to non-form and non-input elements; it is a very rare use-case, and so in addition to the reasons mentioned above, it doesn't make sense to spend development cycles on a feature that not many people are going to be use, especially if such a feature is going to be a bit of a maintenance nightmare and would also make the API more confusing.
Hope this helps! :)
Vivin
On Tuesday, March 5, 2013 1:52:42 AM UTC-7, abed alrahman Almkhieber wrote: