Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6247263
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:50:18+00:00 2026-05-24T12:50:18+00:00

The following code snippet is returning an error in firebug: Parameter is not an

  • 0

The following code snippet is returning an error in firebug:

Parameter is not an object” code: “1003
t.selectNode(s.$); ckeditor.js (line 11883)

My code is basically searching for elements of a certain type e.g input. I then want to make the current element of type selectElement as defined in the API here: http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.dom.selection.html#selectElement

var selectOption = dialog.getValueOf('find', 'findNext');
var documentWrapper = editor.document; // [object Object] ... CKEditor object
var documentNode = documentWrapper.$; // [object HTMLDocument] .... DOM object
elementArray = documentNode.getElementsByTagName(selectOption);
editor.getSelection().selectElement(elementArray[count]);   // Trying to make the     current element of type selectElement
var elementX = editor.getSelection().getSelectedElement();
alert('element ' + elementX.getName());

If I manually highlight an element in the WYSIWYG area then the last two lines of the above code snippet work, and getSelectedElement is defined in the same class as selectElement so I dont know why I’m getting the error.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T12:50:18+00:00Added an answer on May 24, 2026 at 12:50 pm

    Some difficulties:
    getElementsByTagName creates a Node collection, not an array.
    The Node collection is very limited as far as available methods and properties are concerned.

    Here is a concise explanation of the important things to know about Node collections.
    A collection is not an array
    http://www.sitepoint.com/a-collection-is-not-an-array/

    After running getElementsByTagName, I moved the collection into an array.
    The elements were not in a usable format, so I also converted them into DOM elements.

    Rather than working with an element selection, I used a range selection created from the element Node. I found ranges to be more flexible to work with.
    http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.dom.range.html

    Then at the end I created a DOM selection object containing the selected element. I created some sample objects using different methods that are available for a selection object.
    http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.dom.selection.html

    I saw your notes about the object types [object Object] and [object HTMLDocument].
    Have you tried using ” console.log(); ” with FireBug? It shows you all the available methods and properties for each object. I added it for most of the objects in the included code. see what you think.

    Look at the Console panel in FireBug to see the infomation about each object that log is run on. Try console.log( CKEDITOR ); to get a good overview of whats available.

    Important Note: For Internet Explorer you need to open the Developer Tools window and activate Debugging in the Script panel while using ” console.log(); “. Otherwise it will throw an error.

    Here’s the code:

    var selectOption = dialog.getValueOf('find', 'findNext');
    var documentWrapper = editor.document; // [object Object] ... CKEditor object
    var documentNode = documentWrapper.$; // [object HTMLDocument] .... DOM object
    
    // NEW - This isn't an array. getElementsByTagName creates a Node collection
    // Changed name from elementArray to elementCollection
    elementCollection = documentNode.getElementsByTagName(selectOption);
    
    // NEW - Can't use array methods on Node Collection, so move into array and
    // change the collection items into DOM elements
    // NEW - Caveat: The collection is live,
    // so if changes are made to the DOM it could modify the var elementCollection
    
    var nodeArray = [];
    
    for (var i = 0; i < elementCollection.length; ++i) {
        nodeArray[i] = new CKEDITOR.dom.element( elementCollection[ i ] );
    }
    
    // NEW - Working with an element object is problematic.
    // Create a range object to use instead of an element
    // http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.dom.range.html
    var rangeObjForSelection = new CKEDITOR.dom.range( editor.document );
    console.log(rangeObjForSelection);
    
    // NEW - Populate the range object with the desired element
    rangeObjForSelection.selectNodeContents( nodeArray[ count ] );
    console.log(rangeObjForSelection);
    
    // OLD - editor.getSelection().selectElement(elementCollection[count]);
    // Trying to make the current element of type selectElement
    // NEW - Highlight the desired element by selecting it as a range
    editor.getSelection().selectRanges( [ rangeObjForSelection ] );
    
    // OLD - var elementX = editor.getSelection().getSelectedElement();
    // NEW - Create a DOM selection object.
    var selectedRangeObj = new CKEDITOR.dom.selection( editor.document );
    console.log(selectedRangeObj);
    
    // NEW - You can look at the properties and methods available
    // http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.dom.selection.html
    // I've created sample objects using the methods that seem most useful.
    
    var elementX = selectedRangeObj.getRanges();
    console.log(elementX);
    
    var elementX2 = selectedRangeObj.getStartElement();
    console.log(elementX2);
    
    var elementX3 = selectedRangeObj.getSelectedText();
    console.log(elementX3);
    
    var elementX4 = selectedRangeObj.getNative();
    console.log(elementX4);
    

    Be Well,
    Joe

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The following code snippet works in FF but not on IE8. Prev is returning
In emacs, I've read the following code snippet in simple.el : (frame-parameter frame 'buried-buffer-list)
I am using following code snippet, but its not working :-( //First four characters
I have the following code snippet.. I get the error Expected identifier, string or
This following code snippet works in FF, IE and Chrome. However It does not
The following code snippet illustrates a memory leak when opening XPS files. If you
I have the following code snippet. $items['A'] = Test; $items['B'] = Test; $items['C'] =
Consider the following code snippet private void ProcessFile(string fullPath) { XmlTextReader rdr = new
Given the following code snippet from inside a method; NSBezierPath * tempPath = [NSBezierPath
Say I have the following code snippet in c# static const bool DO_PERFORMANCE_CODE =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.