-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Attribute names starting on 'on' don't work #190
Comments
Do you mean you cannot set/get attributes starting "on" ? What are the use cases for such feature? |
The use case is simple - natural attribute names. I wanted to have attributes "on", "off" but I can't. I can't have attributes online, one, onion, onyx etc or any other starting from these words. |
Ok, suppose you create an attribute onyyy, do you expect the value of this attribute to be treated as event handler and be evaluated if an event with name "yyy" propagates through the element with such attribute? |
Why not to copy browsers behavior? "Standard" events can be handled via inline handlers but not custom events.
@OnMouseMove handles 'mousemove' events but @onxxx does not handle 'xxx' event. |
In Ample SDK we have generic support for multiple XML technologies and also let creating custom ones. The list of "Standard" events does not cover all languages, and building specific language technology into the core of the framework doesn't sound as viable solution. I see this behaviour as a nice generic approach to inline handlers in attributes working consistently across all XML languages? What do you think? |
You don't realize that an attribute name can't even start from any of this words. I wanted to create attributes 'onLabel', 'offLabel' but I can't.
|
Yes, this is correct: by design all attribute names starting "on" have been reserved for "inline event handlers". |
Can't you use lazy evaluation? Until event fires event handler is not created? That's how it works in FF/Chrome. |
Good idea for optimization. I will look if this is possible. Still, suppose it is lazy evaluated, and event passes through with matching name, should the attribute be then treated as handler? Isn't this going to be source of unexpected problems? |
Ed, can you open separate request for lazy evaluation? |
All attributes including inline handlers should be treated as attributes. But some of them may have additional meaning. |
Ok, who and how should make sense of 'some with additional meaning'? Suggestions? |
At this moment attributes starting 'on-' can be treated in 2 ways. But I agree - without lazy evaluating it will be hard to solve the issue. |
Question is still open. Suppose we have lazy evaluation in place. Now there is an attribute "once" specified on an element, and an event passes this node with name "ce". Shall the handler be instantiated now and invoked? If not, who and where would have to have provided instructions otherwise. |
When @once attribute is created and special meaning is detected null event handler is created to handle 'ce' events. When 'ce' event is fired null event handler is replaced by actual event handler and invoked. At this moment syntax error exception can be thrown if attribute value is invalid JS. |
Who and where do you think should provide "special meaning" to attributes? |
Attribute names starting on 'on' don't work.
Example (@on is not readable):
In normal HTML documents they work.
The text was updated successfully, but these errors were encountered: