/**
 * Copyright 2015 The AMP HTML Authors. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS-IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import {AmpCarousel} from './carousel';
import {AmpSlideScroll} from './slidescroll';
import {AmpScrollableCarousel} from './scrollable-carousel';
import {CSS} from '../../../build/amp-carousel-0.1.css';
import {isExperimentOn} from '../../../src/experiments';

class CarouselSelector {

  constructor(element) {
    if (element.getAttribute('type') == 'slides') {
      return new AmpSlideScroll(element);
    }
    const scrollableCarouselExpt = isExperimentOn(
        element.ownerDocument.defaultView, 'amp-scrollable-carousel');
    if (scrollableCarouselExpt) {
      return new AmpScrollableCarousel(element);
    }
    return new AmpCarousel(element);
  }
}

AMP.registerElement('amp-carousel', CarouselSelector, CSS);

@@ -911,32 +911,71 @@
 tor 
-%7B%0A%0A  constructor(element
+extends AMP.BaseElement %7B%0A  /** @override */%0A  upgradeCallback(
 ) %7B%0A
@@ -982,16 +982,21 @@
     if (
+this.
 element.
@@ -1063,16 +1063,21 @@
 eScroll(
+this.
 element)
@@ -1143,16 +1143,21 @@
         
+this.
 element.
@@ -1276,32 +1276,37 @@
 ollableCarousel(
+this.
 element);%0A    %7D%0A
@@ -1332,16 +1332,21 @@
 arousel(
+this.
 element)

Use upgrade callback to pick the correct carousel class. (#5899)