.clone(true) not copying <select> data if not explicitly set by "selected" attribute?
.clone(true) does not seem to copy which option was selected if the "selected" attribute is not set (like when a user just chooses an option with the mouse)?
Works:
- <select id="type_id">
- <option value="1">user</option>
- <option value="2" selected="selected">admin</option>
- </select>
Fails:
- <select id="type_id">
- <option value="1">user</option>
- <option value="2">admin</option>
- </select>
Code:
- var orig = $("#type_id").val();
- var clone = $("#type_id").clone(true).val();
- console.log(orig)
- console.log(clone)
it's no big deal to add the attr before cloning, but is it a bug or a feature?
Leon