Comments (2)
If I am understanding this correctly, #2 getInput(), getControl() also return jQuery elements, correct? If the are, the examples are a little inconsistent, which is what threw me off. If that is the case, I like idea #3 because you know they're jQuery and it seems more performant to only query when necessary, however you said performance is negligible.
But I also feel like I'm missing something. What is something like field.search = function(){};
supposed to return in #1?
When you say return a JS type instead of jQuery element, is there a JS object representing a field or do you mean returning an HTML${n}Element
?
from acf.
Hi @tikitariki
Thanks for the reply and feedback. You raised some great points, and I'll address them below:
Point 1
If I am understanding this correctly, #2 getInput(), getControl() also return jQuery elements, correct?
Yes. I've just updated the examples to better reflect this.
Point 2
I like idea #3 because you know they're jQuery and it seems more performant to only query when necessary, however you said performance is negligible.
I'm leaning towards this idea too. It optimizes performance by only querying when needed, but also allows these functions to become dynamic and even allow for parameters.
Point 3
What is something like field.search = function(){}; supposed to return in #1?
This was an example to demonstrate how naming conventions are important. All functions that start with a $ symbolize those that return a jQuery element, nothing else.
Point 4
When you say return a JS type instead of jQuery element, is there a JS object representing a field or do you mean returning an HTML${n}Element?
Here I am talking about the differentiation between a jQuery object and any other JS type. The getX functions should return a JS type (string, int, object, array, etc) where as the findX functions should return a jQuery object.
from acf.
Related Issues (20)
- When returning false in acf/load_field or acf/prepare_field multiple warnings occur HOT 1
- ACF post preview and revisions completely broken HOT 8
- WYSIWYG 'visual' tab in sidebar breaks when switching sidebar tabs HOT 1
- WYSIWYG Editor Field: Image element with width and height attributes triggers unsafe HTML error message HOT 4
- filter wysiwyg_tinymce_settings breaking HOT 1
- Front-end form submits itself when closing the wordpress link-edit dialogue
- Nested cloned repeater only works for 1 level
- Gallery - edit image breaks field in block sidebar HOT 1
- ACF 6.3.0 update breaks "No fields assigned" filter with empty string HOT 3
- Can't add ACF licence key HOT 1
- update_field() not working as expected in this scenario HOT 3
- Installing through composer installs incorrect version HOT 5
- Uncaught TypeError: Cannot access offset of type string on string - flexible content HOT 4
- Fix jQuery deprecations HOT 1
- User field stopped showing in GraphQL query
- Group: image subfield nĀ°10 not working HOT 1
- PLEASE ADD A DISCLAIMER THAT SHORTCODES HAVE TO BE ENABLED NOW HOT 1
- Repeater field type with pagination HOT 1
- Conditional logic in the Advanced Field Settings broke when a wrapper was added v6.2.9.
- Ampersands in Text Area fields produce warnings HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ššš
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ā¤ļø Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from acf.