Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 5 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
| 6 * Copyright (C) 2004, 2005, 2006, 2010 Apple Inc. All rights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2010 Apple Inc. All rights reserved. |
| 7 * Copyright (C) 2010 Google Inc. All rights reserved. | 7 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 8 * Copyright (C) 2011 Motorola Mobility, Inc. All rights reserved. | 8 * Copyright (C) 2011 Motorola Mobility, Inc. All rights reserved. |
| 9 * | 9 * |
| 10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 65 | 65 |
| 66 HTMLOptionElement* HTMLOptionElement::CreateForJSConstructor( | 66 HTMLOptionElement* HTMLOptionElement::CreateForJSConstructor( |
| 67 Document& document, | 67 Document& document, |
| 68 const String& data, | 68 const String& data, |
| 69 const AtomicString& value, | 69 const AtomicString& value, |
| 70 bool default_selected, | 70 bool default_selected, |
| 71 bool selected, | 71 bool selected, |
| 72 ExceptionState& exception_state) { | 72 ExceptionState& exception_state) { |
| 73 HTMLOptionElement* element = new HTMLOptionElement(document); | 73 HTMLOptionElement* element = new HTMLOptionElement(document); |
| 74 element->EnsureUserAgentShadowRoot(); | 74 element->EnsureUserAgentShadowRoot(); |
| 75 element->AppendChild(Text::Create(document, data.IsNull() ? "" : data), | 75 if (!data.IsNull()) |
|
foolip
2017/05/17 11:23:12
The spec says "If text is not the empty string, th
Shanmuga Pandi
2017/05/17 11:29:35
I understood. I will wait for the automatic import
| |
| 76 exception_state); | 76 element->AppendChild(Text::Create(document, data), exception_state); |
| 77 if (exception_state.HadException()) | 77 if (exception_state.HadException()) |
| 78 return nullptr; | 78 return nullptr; |
| 79 | 79 |
| 80 if (!value.IsNull()) | 80 if (!value.IsNull()) |
| 81 element->setValue(value); | 81 element->setValue(value); |
| 82 if (default_selected) | 82 if (default_selected) |
| 83 element->setAttribute(selectedAttr, g_empty_atom); | 83 element->setAttribute(selectedAttr, g_empty_atom); |
| 84 element->SetSelected(selected); | 84 element->SetSelected(selected); |
| 85 | 85 |
| 86 return element; | 86 return element; |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 433 } | 433 } |
| 434 | 434 |
| 435 String HTMLOptionElement::innerText() { | 435 String HTMLOptionElement::innerText() { |
| 436 // A workaround for crbug.com/424578. We add ShadowRoot to an OPTION, but | 436 // A workaround for crbug.com/424578. We add ShadowRoot to an OPTION, but |
| 437 // innerText behavior for Shadow DOM is unclear. We just return the same | 437 // innerText behavior for Shadow DOM is unclear. We just return the same |
| 438 // string before adding ShadowRoot. | 438 // string before adding ShadowRoot. |
| 439 return textContent(); | 439 return textContent(); |
| 440 } | 440 } |
| 441 | 441 |
| 442 } // namespace blink | 442 } // namespace blink |
| OLD | NEW |