-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Implemented HTMLInputElement placeholder attribute #5385
Conversation
Critic review: https://critic.hoppipolla.co.uk/r/4383 This is an external review system which you may optionally use for the code review of your pull request. In order to help critic track your changes, please do not make in-place history rewrites (e.g. via |
Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @metajack (or someone else) soon. |
@Genkku This is a good start! I've left comments on Critic; the most important takeaway is that testing your changes would have demonstrated that the implementation is not yet complete :) |
@jdm Doh! I was also unsure about which tests where relevant. I'll try to make sense of the required changes. |
The spec link in the original issue has a decent HTML example that would show the desired behaviour in the browser of your choice. |
Assigning to @jdm since he already did the initial pass. |
Sorry for the lack of communication. What's the status? Can I still finish this, as I've implemented the feature and it works when testing with servo. I'm now working on the tests. Also, there's a small problem relating to string_cache: &atom!("placeholder") Now this fails, since string_cache doesn't have "placeholder" in 'plugin/src/atom/data.rs'. I locally made the change and tested that it works. Should I make pull request to string_cache? |
For now, you can just use Atom::from_slice("placeholder") instead of using the atom macro. And yes, do go ahead and finish this work - we're just assigning the PRs to team members as a way of saying "you're responsible for making sure this PR doesn't get forgotten". |
It might be that I'm confused and using Atom::from_slice("placeholder") in a wrong way, but it seems that it can't be matched against. Various unsatisfactory hacks don't work either (local variables, constants, etc.) I fixed the test expectations that we're expected to fail, but I'm also getting a few failed tests. I'm unsure whether they're related to the changes I've made:
|
I admit that I don't know what to make of that. The first two look like the changes from #5476, and I've seen the reflection ones time out before for testharness-related reasons, but the rest are super weird. Maybe try submitting the changes you have and we'll see what happens on the test machines? |
With regards to Atom::from_slice, are you using |
Oh wait, that probably doesn't work. You may need a separate |
I failed to find a way to accomplish this without excessive mutation. I'm also wondering if there's a more idiomatic way to strip the line breaks. |
http://mxr.mozilla.org/servo/source/components/script/dom/window.rs#249 is a nice example of removing whitespace from strings. |
I've left some more comments on Critic, but this is looking much more like what I was expecting :) |
I tried removing the to_owned() on line 159, but it fails: 'cannot move out of borrowed content'. |
One teeny little style nit left, and then it's mergeable! |
Haha, I got a bit ahead of myself and let that one slip past me :) |
Squash! |
+ modified HTMLInputElement.webidl to include placeholder + modified placeholder test expectations
@jdm hopefully everything is fine and dandy now! |
I'm unsure whether I should wrap 'placeholder' in Cell, or DomRefCell, or leave as it is now. Also, the spec says that the placeholder should be presented with line breaks stripped off, should it be done in this stage?
I'm unsure whether I should wrap 'placeholder' in Cell, or DomRefCell, or leave as it is now. Also, the spec says that the placeholder should be presented with line breaks stripped off, should it be done in this stage?
I'm unsure whether I should wrap 'placeholder' in Cell, or DomRefCell, or leave as it is now.
Also, the spec says that the placeholder should be presented with line breaks stripped off,
should it be done in this stage?