Closed Bug 1492097 Opened 7 years ago Closed 7 years ago

<optgroup> crops <option> text after '-'

Categories

(Core :: DOM: Core & HTML, defect, P2)

49 Branch
defect

Tracking

()

RESOLVED INVALID

People

(Reporter: manalideshmukh02, Unassigned, NeedInfo)

Details

Attachments

(1 file)

Attached image optGroupBug.PNG
User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.92 Safari/537.36 Steps to reproduce: 1. I have created a select with optgroup. 2. Added a option containing '-'. For Ex. I have drop down with option 'Deployment-plan' 3. When I select a value from optGroup , I am triggering click event where I capture the selected value from drop down. Actual results: Ideally when I select a value from drop down, it should return value as 'Deployment-Plan' but when I use optgroup it is skipping everything after '-'. So I am getting result as 'Deployment' only instead of 'Deployment-Plan' Expected results: I should get whatever selected value as it is without cropping string.
Not a security problem, so unhiding. Please could you attach (or link to) a publicly accessible testcase that demonstrates the problem? What version of Firefox are you seeing issues with?
Group: firefox-core-security
Component: Untriaged → HTML: Form Submission
Product: Firefox → Core
A standalone testcase would be nice.
Component: HTML: Form Submission → DOM: Core & HTML
Flags: needinfo?(manalideshmukh02)
Priority: -- → P2
Summary: click event on select optgroup does not work properly in Firefox → <optgroup> crops <option> text after '-'
I quickly whipped up https://highfalutin-orca.glitch.me and can't reproduce. I'm sure I'm just doing something wrong, though.
The issue is coming if drop down option contains space. Added code below for your reference. I ran it on w3 schools: <!DOCTYPE html> <html> <head> <title>Try jQuery Online</title> <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script> $(document).ready(function() { var opt = { friendchat:[ {name:"somefriend1-1", uri:"1"}, {name:"somefriend2 11", uri:"1"} ], otherchat:[ {name:"someother1", uri:"1"}, {name:"someother2", uri:"1"} ], friendrequest:[ {name:"somerequest1", uri:"1"}, {name:"somerequest2", uri:"1"} ], sentrequest:[ {name:"somesent1", uri:"1"}, {name:"somesent2", uri:"1"} ] }; $(function(){ var $select = $('#mySelect'); $.each(opt, function(key, value){ var group = $('<optgroup label="' + key + '" />'); $.each(value, function(){ $('<option/>').html(this.name).appendTo(group); }); group.appendTo($select); }); $("#mySelect").change(function(){ console.log($(this)[0].value); }); }); }); </script> <style> .selected { color:red; } .highlight { background:yellow; } </style> </head> <body> <select id="mySelect" size="9"> </select> <h1>how to add them with code only?</h1> </body> </html>
Flags: needinfo?(manalideshmukh02)
I loaded the code you pasted into the w3schools tryit editor and got this: https://www.w3schools.com/code/tryit.asp?filename=FVF7HVR81J70 . If I click the "somefriend1-1" entry, in Firefox 63 beta on mac, the console.log reports "somefriend1-1" just fine - nothing is being lost. What are you seeing instead, and what version of Firefox are you testing with?
Flags: needinfo?(manalideshmukh02)
Can you select “somefriend2 11” and see the output? I am using Firefox 49
Flags: needinfo?(manalideshmukh02)
(In reply to manalideshmukh02 from comment #6) > Can you select “somefriend2 11” and see the output? It shows "somefriend2 11", which sounds right? That value doesn't have a '-'.... > I am using Firefox 49 Firefox 49 is 2 years old and no longer supported. Does the problem go away if you use a supported, recent version of Firefox (current release is Firefox 62) ?
Flags: needinfo?(manalideshmukh02)
Closing this as invalid for now. Please reopen if you can produce a testcase that demonstrates the problem. (You can attach it using the "Attach File" link on this bug report).
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: