 
   describe('text', ->
     beforeEach( ->
-      $(testContainer).html('0<span>1</span><!-- Comment --><b><i>2</i></b>3<br>')
+      $(@container).html('0<span>1</span><!-- Comment --><b><i>2</i></b>3<br>')
     )
 
     it('should retrieve text', ->
-      expect(Quill.DOM.getText(testContainer)).to.equal('0123')
+      expect(Quill.DOM.getText(@container)).to.equal('0123')
     )
 
     it('should set element text', ->
-      Quill.DOM.setText(testContainer, 'test')
-      expect($(testContainer).text()).to.equal('test')
+      Quill.DOM.setText(@container, 'test')
+      expect($(@container).text()).to.equal('test')
     )
 
     it('should set text node text', ->
-      Quill.DOM.setText(testContainer.firstChild, 'A')
-      expect($(testContainer).text()).to.equal('A123')
+      Quill.DOM.setText(@container.firstChild, 'A')
+      expect($(@container).text()).to.equal('A123')
     )
 
     it('should get all text nodes', ->
-      textNodes = Quill.DOM.getTextNodes(testContainer)
+      textNodes = Quill.DOM.getTextNodes(@container)
       expect(textNodes.length).to.equal(4)
     )
   )
 
   describe('manipulation', ->
     beforeEach( ->
-      $(testContainer).html('<div style="cursor: pointer">One</div><div><span>Two</span><b>Bold</b></div>')
+      $(@container).html('<div style="cursor: pointer">One</div><div><span>Two</span><b>Bold</b></div>')
     )
 
     it('moveChildren', ->
-      Quill.DOM.moveChildren(testContainer.firstChild, testContainer.lastChild)
-      expect.equalHTML(testContainer, '<div style="cursor: pointer>One<span>Two</span><b>Bold</b></div><div></div>')
+      Quill.DOM.moveChildren(@container.firstChild, @container.lastChild)
+      expect.equalHTML(@container, '<div style="cursor: pointer>One<span>Two</span><b>Bold</b></div><div></div>')
     )
 
     it('removeNode', ->
-      Quill.DOM.removeNode(testContainer.lastChild.firstChild)
-      expect.equalHTML(testContainer, '<div style="cursor: pointer>One</div><div><b>Bold</b></div>')
+      Quill.DOM.removeNode(@container.lastChild.firstChild)
+      expect.equalHTML(@container, '<div style="cursor: pointer>One</div><div><b>Bold</b></div>')
     )
 
     it('switchTag', ->
-      Quill.DOM.switchTag(testContainer.firstChild, 'span')
-      expect.equalHTML(testContainer, '<span style="cursor: pointer>One</span><div><span>Two</span><b>Bold</b></div>')
+      Quill.DOM.switchTag(@container.firstChild, 'span')
+      expect.equalHTML(@container, '<span style="cursor: pointer>One</span><div><span>Two</span><b>Bold</b></div>')
     )
 
     it('unwrap', ->
-      Quill.DOM.unwrap(testContainer.lastChild)
-      expect.equalHTML(testContainer, '<div style="cursor: pointer>One</div><span>Two</span><b>Bold</b>')
+      Quill.DOM.unwrap(@container.lastChild)
+      expect.equalHTML(@container, '<div style="cursor: pointer>One</div><span>Two</span><b>Bold</b>')
     )
 
     it('wrap', ->
-      wrapper = testContainer.ownerDocument.createElement('div')
-      Quill.DOM.wrap(wrapper, testContainer.firstChild)
-      expect.equalHTML(testContainer, '<div><div style="cursor: pointer>One</div></div><div><span>Two</span><b>Bold</b></div>')
+      wrapper = @container.ownerDocument.createElement('div')
+      Quill.DOM.wrap(wrapper, @container.firstChild)
+      expect.equalHTML(@container, '<div><div style="cursor: pointer>One</div></div><div><span>Two</span><b>Bold</b></div>')
     )
   )
 
   describe('select', ->
     beforeEach( ->
-      $(testContainer).html('
+      $(@container).html('
         <select>
           <option value="one">One</option>
           <option value="two" selected>Two</option>
         </select>
       ')
-      @select = testContainer.children[0]
+      @select = @container.firstChild
       $(@select).val('one')
     )
 

      'display': 'inline'

    it('should retrieve styles', ->
      $(testContainer).html(html)
      result = Quill.DOM.getStyles(testContainer.firstChild)
      expect(result).to.eql(styles)
    )

    it('should set styles', ->
      $(testContainer).html('<span>Test</span>')
      Quill.DOM.setStyles(testContainer.firstChild, styles)
      expect.equalHTML(testContainer.firstChild.outerHTML, html)
    )
  )

  describe('events', ->
    beforeEach( ->
      $(testContainer).html('
        <div>
          <button type="button">Button</button>
          <select>

describe('DOM', ->
  beforeEach( ->
    @container = $('#test-container').html('').get(0)
  )

  describe('classes', ->
    afterEach( ->
      $(@container).removeClass()
    )

    it('addClass', ->
      Quill.DOM.addClass(@container, 'custom')
      expect($(@container).hasClass('custom')).to.be(true)
    )

    it('getClasses', ->
      $(@container).addClass('custom')
      $(@container).addClass('another')
      classes = Quill.DOM.getClasses(@container)
      expect(_.union(classes, ['custom', 'another']).length).to.equal(2)
    )

    it('hasClass', ->
      $(@container).addClass('custom')
      expect(Quill.DOM.hasClass(@container, 'custom')).to.be(true)
    )

    it('removeClass', ->
      $(@container).addClass('custom')
      Quill.DOM.removeClass(@container, 'custom')
      expect($(@container).hasClass('custom')).to.be(false)
    )

    it('toggleClass', ->
      Quill.DOM.toggleClass(@container, 'custom')
      expect($(@container).hasClass('custom')).to.be(true)
      Quill.DOM.toggleClass(@container, 'custom')
      expect($(@container).hasClass('custom')).to.be(false)
    )
  )

  describe('attributes', ->
    beforeEach( ->
      $(@container).html('<div class="custom" style="color: red;"></div>')
      @node = @container.firstChild
    )

    it('getAttributes', ->
