1// Copyright (c) 2013 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5function isOptionElementToggleable(option) {
6  if (option.tagName.toLowerCase() != 'option')
7    throw new Error('element is not an option');
8  for (var parent = option.parentElement;
9       parent;
10       parent = parent.parentElement) {
11    if (parent.tagName.toLowerCase() == 'select') {
12      return parent.multiple;
13    }
14  }
15  throw new Error('option element is not in a select');
16}
17