? Failure

User tests: Successful: Unsuccessful:

avatar dbclkclk
dbclkclk
18 Mar 2016

Pull Request for Issue # .

Summary of Changes

Testing Instructions

HTML 5 allows for data-* attribute to be assigned to html form elements. Even ASP.NET MVC core form elements allows for the definition of data-* attributes.

avatar dbclkclk dbclkclk - open - 18 Mar 2016
avatar dbclkclk dbclkclk - change - 18 Mar 2016
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 18 Mar 2016
Labels Added: ?
avatar dbclkclk
dbclkclk - comment - 18 Mar 2016

Note that this allows for integration with KnockoutJS, Angularjs, etc.

avatar Bakual
Bakual - comment - 18 Mar 2016

Can you a bit more specific what the purpose of this change would be? And how it could be tested?

avatar jackkum
jackkum - comment - 18 Mar 2016

@Bakual
Sometimes could be useful pass the object from html element to the javascript code

$array = ['id' => 12345, 'title' => 'Some title', 'someMore' => '...'];
<input type="..." data-some-object="<?php echo htmlspecialchars(json_encode($array), ENT_QUOTES, 'UTF-8'); ?>" />
var data = $('#element-id').data('some-object');
console.log(data.someMore);
avatar Bakual
Bakual - comment - 18 Mar 2016

This change looks like you would specify that object data in the form XML file. I don't see yet the global need for that. I think it's simpler to just extend the formfield and add your specific requirements into it.
Having a preg_match running on each list element attribute when it's used only in a few very specific cases looks wrong to me.

avatar Fedik
Fedik - comment - 18 Mar 2016

I think this better do in the field layout override, if you need it .. in J 3.5 it should be even more easy

avatar brianteeman brianteeman - change - 22 Mar 2016
Category Libraries
avatar brianteeman
brianteeman - comment - 22 Mar 2016

@dbclkclk please can you fix the code style errors

FOUND 17 ERROR(S) AFFECTING 9 LINE(S)

47 | ERROR | Functions and classes must not contain multiple empty lines in a
| | row; found 2 empty lines
49 | ERROR | Tabs must be used to indent lines; spaces are not allowed
50 | ERROR | Tabs must be used to indent lines; spaces are not allowed
51 | ERROR | Tabs must be used to indent lines; spaces are not allowed
51 | ERROR | Expected "if (...)\n...{...}\n...else\n"; found
| | "if(...)\n...{...}\n...else\n"
52 | ERROR | Tabs must be used to indent lines; spaces are not allowed
53 | ERROR | Tabs must be used to indent lines; spaces are not allowed
53 | ERROR | Concat operator must be followed by one space
53 | ERROR | Concat operator must be preceeded by one space
53 | ERROR | Concat operator must be followed by one space
53 | ERROR | Concat operator must be preceeded by one space
53 | ERROR | Concat operator must be followed by one space
53 | ERROR | Concat operator must be preceeded by one space
54 | ERROR | Tabs must be used to indent lines; spaces are not allowed
55 | ERROR | Tabs must be used to indent lines; spaces are not allowed
55 | ERROR | Closing brace indented incorrectly; expected 3 spaces, found 16
56 | ERROR | Functions and classes must not contain multiple empty lines in a
| | row; found 2 empty lines


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9463.

avatar brianteeman brianteeman - change - 12 May 2016
Status Pending Information Required
avatar brianteeman
brianteeman - comment - 12 May 2016

This PR will be closed in a few weeks if the code style issues are not resoled


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9463.

avatar wojsmol
wojsmol - comment - 14 May 2016
avatar ggppdk
ggppdk - comment - 15 May 2016

@wojsmol , @dbclkclk

This is nice to have, there are many uses of data-* attributes

  • many developers extend JFormFieldList and add this

Some comments

if (preg_match('(data-[a-zA-Z\-]+)', $a))
  • does not allow number in name which is legitimate: data-somename1=""
  • does not allow legimate Unicode characters

why would not trust the developer has created a proper names in the XML file ?


1 . So i think better just use:

if (preg_match('(data-)', $a))

2 . Also this is 2x faster

if ( strpos($a, 'data-') === 0 ) 

Example for 500,000 calls aka 500,000 list fields (<select>)

0,15ms versus 0,30ms on same processor

  • so it is not really needed, unless someone in the future decides to add in similar way data- attributes in the <option>
avatar brianteeman
brianteeman - comment - 7 Jun 2016

I am closing this at this time as it cannot be merged in its current state and there has been no response to the request to update the code. It can always b reopened if that is done.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9463.

avatar brianteeman brianteeman - change - 7 Jun 2016
Status Information Required Closed
Closed_Date 0000-00-00 00:00:00 2016-06-07 09:56:50
Closed_By brianteeman
avatar brianteeman brianteeman - close - 7 Jun 2016

Add a Comment

Login with GitHub to post a comment