A javascript "undefined error" in linkit.dashboard.js on line 153 is causing the Linkit to not work after the "Insert Link" is clicked. The result is the ajax response errors out and the page is taken to the response code.
line 153
attributes.push($(this).attr('name').substr(7));
Error: substr can't be called on undefined.
Looking the code, the loop on line 151 $('#linkit-modal .linkit-attributes .linkit-attribute').each(function() {
is pulling in elements that don't have a "name" attribute. This errors out the Drupal.linkit.additionalAttributes
function.
Adding a if () for a name attribute should fix the problem.
Comment | File | Size | Author |
---|---|---|---|
#1 | jsundefinederror-2158561-1.patch | 564 bytes | travelertt |
Comments
Comment #1
travelerttPatch adds a if() checking for a "name" attribute on the loop item.
Comment #2
travelerttI believe this is problem do to newer browsers being stricter js errors.
Was running Chrome Version 31.0.1650.63 and jquery 1.7
Comment #3
anonWhat type of element don't have a name?
Don't all elements need a name? I mean why add it without a name, it can't be posted if it doesn't have a name.
Comment #4
travelerttdouble entryComment #5
travelerttMany elements don't have the name attribute. In this instance I believe it was finding a
Comment #6
anon"Many elements don't have the name attribute"
This is the real problem.
Linkit tries to pull elements out of a form.
All form elements can have a name attribute, and in fact, they should! What kind of input, select and so on doesn't have a name?
They are given names thru FAPI, if they don't, something is really messed up here.
Comment #7
anonoh, I missed your "I believe it was finding a ".
Then I most know what kind of attributes do you have active?
Only the once that comes with Linkit core, or any own, or contrib attributes?
As Linkit core don't put "linkit-attribute" classes on any
<a>
tags.Comment #8
travelerttSorry about that. I must have deleted the wrong duplicate post. It is finding a
Comment #9
anonAnyway, it doesn't make sense. The sciprt you havnig an error with is just using elements with the class "linkit-attribute".
If any other elements except the attribute field in the form have that class, something is really wrong, and it's not in control of Linkit.
Comment #10
anonComment #12
anonClosing again, the test bot change the status for some reason.